Skip to content

Commit

Permalink
Merge branch 'PHP-8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Jan 9, 2025
2 parents 0f40e62 + e975c27 commit adcd3ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
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

0 comments on commit adcd3ad

Please sign in to comment.