diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 15:09:15 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 15:09:30 +0200 |
commit | 4a469c7e9895360a7c605fbb9ea4e062661b666f (patch) | |
tree | fd8e8b6e297f3769f20a830bf136e9961de4605c | |
parent | acce991a37e3ab0f86c1aed3e2008d130d99c0d1 (diff) | |
parent | c1962e900a4ebe74a6e7578e3da75a0931687546 (diff) | |
download | php-git-4a469c7e9895360a7c605fbb9ea4e062661b666f.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/imap/php_imap.c | 6 | ||||
-rw-r--r-- | ext/imap/tests/bug80223.phpt | 15 |
3 files changed, 21 insertions, 2 deletions
@@ -17,6 +17,8 @@ PHP NEWS . Fixed bug #80213 (imap_mail_compose() segfaults on certain $bodies). (cmb) . Fixed bug #80215 (imap_mail_compose() may modify by-val parameters). (cmb) . Fixed bug #80220 (imap_mail_compose() may leak memory). (cmb) + . Fixed bug #80223 (imap_mail_compose() leaks envelope on malformed bodies). + (cmb) - MySQLnd: . Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 4afc4229dd..16cacbd91f 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -3634,7 +3634,8 @@ PHP_FUNCTION(imap_mail_compose) if (Z_TYPE_P(data) != IS_ARRAY) { php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array"); - RETURN_FALSE; + RETVAL_FALSE; + goto done; } SEPARATE_ARRAY(data); @@ -3836,7 +3837,8 @@ PHP_FUNCTION(imap_mail_compose) if (first) { php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array"); - RETURN_FALSE; + RETVAL_FALSE; + goto done; } if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) { diff --git a/ext/imap/tests/bug80223.phpt b/ext/imap/tests/bug80223.phpt new file mode 100644 index 0000000000..4acfb8d023 --- /dev/null +++ b/ext/imap/tests/bug80223.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #80223 (imap_mail_compose() leaks envelope on malformed bodies) +--SKIPIF-- +<?php +if (!extension_loaded('imap')) die('skip imap extension not available'); +?> +--FILE-- +<?php +imap_mail_compose([], []); +imap_mail_compose([], [1]); +?> +--EXPECTF-- +Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d + +Warning: imap_mail_compose(): body parameter must be a non-empty array in %s on line %d |