Skip to content

Commit fc022da

Browse files
committed
ext/mbstring: fix new_value length check
Commit 8bbd095 added a check rejecting empty strings; in the merge commiot 379d9a1 however it was changed to a NULL check, one that did not make sense because ZSTR_VAL() is guaranteed to never be NULL; the length check was accidently removed by that merge commit. This bug was found by GCC's -Waddress warning: ext/mbstring/mbstring.c:748:27: warning: the comparison will always evaluate as ‘true’ for the address of ‘val’ will never be NULL [-Waddress] 748 | if (!new_value || !ZSTR_VAL(new_value)) { | ^
1 parent 131b862 commit fc022da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
745745
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_input is deprecated");
746746
}
747747

748-
if (!new_value || !ZSTR_VAL(new_value)) {
748+
if (!new_value || !ZSTR_LEN(new_value)) {
749749
const char *encoding = php_get_input_encoding();
750750
MBSTRG(http_input_set) = 0;
751751
_php_mb_ini_mbstring_http_input_set(encoding, strlen(encoding));

0 commit comments

Comments
 (0)