Skip to content

Commit adcd3ad

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 0f40e62 + e975c27 commit adcd3ad

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ext/gettext/gettext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ PHP_FUNCTION(bindtextdomain)
183183
char *retval, dir_name[MAXPATHLEN], *btd_result;
184184

185185
ZEND_PARSE_PARAMETERS_START(1, 2)
186-
Z_PARAM_STR(domain)
186+
Z_PARAM_PATH_STR(domain)
187187
Z_PARAM_OPTIONAL
188-
Z_PARAM_STR_OR_NULL(dir)
188+
Z_PARAM_PATH_STR_OR_NULL(dir)
189189
ZEND_PARSE_PARAMETERS_END();
190190

191191
PHP_GETTEXT_DOMAIN_LENGTH_CHECK(1, ZSTR_LEN(domain))

ext/gettext/tests/gh17400.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-17400 bindtextdomain segfaults with invalid domain/domain with null bytes.
3+
--EXTENSIONS--
4+
gettext
5+
--CREDITS--
6+
YuanchengJiang
7+
--FILE--
8+
<?php
9+
$utf16_first_le = pack("H*", "00d800dc");
10+
$utf16le_char_bad = pack("H*", "00dc00dc");
11+
12+
try {
13+
bindtextdomain($utf16le_char_bad,$utf16_first_le);
14+
} catch (\ValueError $e) {
15+
echo $e->getMessage();
16+
}
17+
?>
18+
--EXPECT--
19+
bindtextdomain(): Argument #1 ($domain) must not contain any null bytes

0 commit comments

Comments
 (0)