]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.1' into PHP-7.2
authorStanislav Malyshev <stas@php.net>
Tue, 30 Apr 2019 05:09:04 +0000 (22:09 -0700)
committerStanislav Malyshev <stas@php.net>
Tue, 30 Apr 2019 05:09:04 +0000 (22:09 -0700)
* PHP-7.1:
  Fix #77821: Potential heap corruption in TSendMail()

1  2 
win32/sendmail.c

index 62d710589de968284001ff7f9a5d718ce91c2014,c11da78f32984fa09a1b1406b6c8e0513f4d1123..c171eba950c3a607acaf20967c3b537b08d0fb35
@@@ -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()",