From 018251a7c492916a6fa2c0e9a5e7adaba14bd614 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 3 Jan 2020 11:14:45 +0100 Subject: Fixed bug #71876 This is a backport of fcdc0a6db0ae63fbed9e3828137b899b844623ce to the PHP-7.3 branch. We need to make sure that OnUpdateString is also called for a NULL value, otherwise the reset of the encoding at the end of the request will not work. I believe I already tried to land this before once, but it didn't actually end up on the PHP-7.3 branch due to a push conflict that I only noticed just now. --- NEWS | 4 ++++ main/main.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 8f20e99211..e969370949 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 7.3.15 +- Core: + . Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not + supported). (Nikita) + - CURL: . Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()). (cmb) diff --git a/main/main.c b/main/main.c index 6917fe3230..30629117d9 100644 --- a/main/main.c +++ b/main/main.c @@ -588,8 +588,8 @@ static PHP_INI_DISP(display_errors_mode) */ static PHP_INI_MH(OnUpdateDefaultCharset) { + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); #ifdef PHP_WIN32 php_win32_cp_do_update(ZSTR_VAL(new_value)); #endif @@ -602,8 +602,8 @@ static PHP_INI_MH(OnUpdateDefaultCharset) */ static PHP_INI_MH(OnUpdateInternalEncoding) { + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); #ifdef PHP_WIN32 php_win32_cp_do_update(ZSTR_VAL(new_value)); #endif @@ -616,8 +616,8 @@ static PHP_INI_MH(OnUpdateInternalEncoding) */ static PHP_INI_MH(OnUpdateInputEncoding) { + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); #ifdef PHP_WIN32 php_win32_cp_do_update(NULL); #endif @@ -630,8 +630,8 @@ static PHP_INI_MH(OnUpdateInputEncoding) */ static PHP_INI_MH(OnUpdateOutputEncoding) { + OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); if (new_value) { - OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); #ifdef PHP_WIN32 php_win32_cp_do_update(NULL); #endif -- cgit v1.2.1