diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c index 53eaf7975457d..27f0dfa26da70 100644 --- a/ext/gettext/gettext.c +++ b/ext/gettext/gettext.c @@ -183,9 +183,9 @@ PHP_FUNCTION(bindtextdomain) char *retval, dir_name[MAXPATHLEN], *btd_result; ZEND_PARSE_PARAMETERS_START(1, 2) - Z_PARAM_STR(domain) + Z_PARAM_PATH_STR(domain) Z_PARAM_OPTIONAL - Z_PARAM_STR_OR_NULL(dir) + Z_PARAM_PATH_STR_OR_NULL(dir) ZEND_PARSE_PARAMETERS_END(); PHP_GETTEXT_DOMAIN_LENGTH_CHECK(1, ZSTR_LEN(domain)) diff --git a/ext/gettext/tests/gh17400.phpt b/ext/gettext/tests/gh17400.phpt new file mode 100644 index 0000000000000..836b792bf0de7 --- /dev/null +++ b/ext/gettext/tests/gh17400.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-17400 bindtextdomain segfaults with invalid domain/domain with null bytes. +--EXTENSIONS-- +gettext +--CREDITS-- +YuanchengJiang +--FILE-- +getMessage(); +} +?> +--EXPECT-- +bindtextdomain(): Argument #1 ($domain) must not contain any null bytes