diff --git a/NEWS b/NEWS index 5d945dfde1b5f..34ff5848d57ad 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2018, PHP 5.6.39 - IMAP: + . Fixed bug #77020 (null pointer dereference in imap_mail). (cmb) . Fixed bug #77153 (imap_open allows to run arbitrary shell commands via mailbox parameter). (Stas) diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index a23e84c085216..b30440f000f38 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -4094,7 +4094,6 @@ PHP_FUNCTION(imap_mail) if (!message_len) { /* this is not really an error, so it is allowed. */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "No message string in mail command"); - message = NULL; } if (_php_imap_mail(to, subject, message, headers, cc, bcc, rpath TSRMLS_CC)) { diff --git a/ext/imap/tests/bug77020.phpt b/ext/imap/tests/bug77020.phpt new file mode 100644 index 0000000000000..8a65232eec6d3 --- /dev/null +++ b/ext/imap/tests/bug77020.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #77020 (null pointer dereference in imap_mail) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: imap_mail(): No message string in mail command in %s on line %d +%s +===DONE===