mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
ext/mbstring: fix new_value length check
Commit8bbd0952e5
added a check rejecting empty strings; in the merge commiot379d9a1cfc
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)) { | ^ Closes GH-10532 Signed-off-by: George Peter Banyard <girgias@php.net>
This commit is contained in:
parent
ae16471628
commit
243865ae57
5
NEWS
5
NEWS
@ -35,6 +35,9 @@ PHP NEWS
|
||||
. Fixed JSON scanner and parser generation build.
|
||||
(Daniel Black, Jakub Zelenka)
|
||||
|
||||
- MBString:
|
||||
. ext/mbstring: fix new_value length check. (Max Kellermann)
|
||||
|
||||
- Opcache:
|
||||
. Fix incorrect page_size check. (nielsdos)
|
||||
|
||||
@ -71,7 +74,7 @@ PHP NEWS
|
||||
- SAPI:
|
||||
. Fixed bug GHSA-54hq-v5wp-fqgv (DOS vulnerability when parsing multipart
|
||||
request body). (CVE-2023-0662) (Jakub Zelenka)
|
||||
|
||||
|
||||
02 Feb 2023, PHP 8.1.15
|
||||
|
||||
- Apache:
|
||||
|
@ -745,7 +745,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
|
||||
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_input is deprecated");
|
||||
}
|
||||
|
||||
if (!new_value || !ZSTR_VAL(new_value)) {
|
||||
if (!new_value || !ZSTR_LEN(new_value)) {
|
||||
const char *encoding = php_get_input_encoding();
|
||||
MBSTRG(http_input_set) = 0;
|
||||
_php_mb_ini_mbstring_http_input_set(encoding, strlen(encoding));
|
||||
|
Loading…
Reference in New Issue
Block a user