If an empty $message is passed to imap_mail(), we must not set message
to NULL, since _php_imap_mail() is not supposed to handle NULL pointers
(opposed to pointers to NUL).
?? ??? 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)
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)) {
--- /dev/null
+--TEST--
+Bug #77020 (null pointer dereference in imap_mail)
+--SKIPIF--
+<?php
+if (!extension_loaded('imap')) die('skip imap extension not available');
+?>
+--FILE--
+<?php
+imap_mail('1', 1, NULL);
+?>
+===DONE===
+--EXPECTF--
+Warning: imap_mail(): No message string in mail command in %s on line %d
+%s
+===DONE===