Skip to content

Commit c510083

Browse files
nielsdosdevnexen
authored andcommitted
Fix incorrect string length for output_handler in zlib ini code
The length of "output_handler" is supposed to be passed, but as sizeof is used, the resulting number includes the NUL character, so the length is off-by-one. Subtract one to pass the correct length. Closes GH-10667.
1 parent c4c861b commit c510083

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ PHP NEWS
7474
4GB. (Girgias)
7575
. Add missing error check on tidyLoadConfig. (nielsdos)
7676

77+
- Zlib:
78+
. Fixed output_handler directive value's length which counted the string
79+
terminator. (nieldos)
80+
7781
14 Feb 2023, PHP 8.1.16
7882

7983
- Core:

ext/zlib/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression)
12791279
} else {
12801280
int_value = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
12811281
}
1282-
ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 0);
1282+
ini_value = zend_ini_string("output_handler", sizeof("output_handler") - 1, 0);
12831283

12841284
if (ini_value && *ini_value && int_value) {
12851285
php_error_docref("ref.outcontrol", E_CORE_ERROR, "Cannot use both zlib.output_compression and output_handler together!!");

0 commit comments

Comments
 (0)