Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #77821: Potential heap corruption in TSendMail()
This commit is contained in:
Stanislav Malyshev 2019-04-29 22:09:15 -07:00
commit f7d59844e1

View File

@ -252,8 +252,9 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
}
if (!found) {
if (headers_lc) {
zend_string_free(headers_lc);
if (headers) {
zend_string_release(headers_trim);
zend_string_release(headers_lc);
}
*error = W32_SM_SENDMAIL_FROM_NOT_SET;
return FAILURE;
@ -267,8 +268,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
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 */
*error_message = ecalloc(1, HOST_NAME_LEN + 128);
@ -284,8 +285,8 @@ PHPAPI int TSendMail(char *host, int *error, char **error_message,
efree(RPath);
}
if (headers) {
zend_string_free(headers_trim);
zend_string_free(headers_lc);
zend_string_release(headers_trim);
zend_string_release(headers_lc);
}
if (ret != SUCCESS) {
*error = ret;