From: Stanislav Malyshev Date: Tue, 30 Apr 2019 05:09:04 +0000 (-0700) Subject: Merge branch 'PHP-7.1' into PHP-7.2 X-Git-Tag: php-7.3.6RC1~21^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c3933821fe2d401ae128f25047935671c43dd98;p=php Merge branch 'PHP-7.1' into PHP-7.2 * PHP-7.1: Fix #77821: Potential heap corruption in TSendMail() --- 2c3933821fe2d401ae128f25047935671c43dd98 diff --cc win32/sendmail.c index 62d710589d,c11da78f32..c171eba950 --- a/win32/sendmail.c +++ b/win32/sendmail.c @@@ -276,11 -290,13 +277,11 @@@ PHPAPI int TSendMail(char *host, int *e efree(RPath); } if (headers) { - zend_string_free(headers_trim); - zend_string_free(headers_lc); + zend_string_release(headers_trim); + zend_string_release(headers_lc); } /* 128 is safe here, the specifier in snprintf isn't longer than that */ - if (NULL == (*error_message = ecalloc(1, HOST_NAME_LEN + 128))) { - return FAILURE; - } + *error_message = ecalloc(1, HOST_NAME_LEN + 128); snprintf(*error_message, HOST_NAME_LEN + 128, "Failed to connect to mailserver at \"%s\" port %d, verify your \"SMTP\" " "and \"smtp_port\" setting in php.ini or use ini_set()",