diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 15:10:55 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-12 15:10:55 +0200 |
| commit | 2e17c937bf49ad801b820241d7ef5575ba786bc0 (patch) | |
| tree | 1e2e53ad267c67a28be7f1d6fe04acbd7e15b91c | |
| parent | c3365bb301fd0a0cb6b5e3b6df5f6742d4262dca (diff) | |
| parent | 0443c824a3a716873440c8e239d40c458d966a21 (diff) | |
| download | php-git-2e17c937bf49ad801b820241d7ef5575ba786bc0.tar.gz | |
Merge branch 'PHP-8.0' into master
* PHP-8.0:
Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
| -rw-r--r-- | ext/imap/php_imap.c | 6 | ||||
| -rw-r--r-- | ext/imap/tests/bug80223.phpt | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 26947f9e79..0fc59a65e0 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -3172,7 +3172,8 @@ PHP_FUNCTION(imap_mail_compose) if (Z_TYPE_P(data) != IS_ARRAY) { // TODO ValueError php_error_docref(NULL, E_WARNING, "body parameter must be a non-empty array"); - RETURN_FALSE; + RETVAL_FALSE; + goto done; } SEPARATE_ARRAY(data); @@ -3375,7 +3376,8 @@ PHP_FUNCTION(imap_mail_compose) if (first) { // TODO ValueError 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 |
