Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/gettext/gettext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
19 changes: 19 additions & 0 deletions ext/gettext/tests/gh17400.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
GH-17400 bindtextdomain segfaults with invalid domain/domain with null bytes.
--EXTENSIONS--
gettext
--CREDITS--
YuanchengJiang
--FILE--
<?php
$utf16_first_le = pack("H*", "00d800dc");
$utf16le_char_bad = pack("H*", "00dc00dc");

try {
bindtextdomain($utf16le_char_bad,$utf16_first_le);
} catch (\ValueError $e) {
echo $e->getMessage();
}
?>
--EXPECT--
bindtextdomain(): Argument #1 ($domain) must not contain any null bytes
Loading