summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-10-12 23:21:35 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-10-12 23:21:56 +0200
commit818eb8f6113c53cad40ffb4ba19de30429dfe475 (patch)
treea8a72ecd24cd1850d9000077c683170b83a60178
parent87beb22ff80a1d994cda6a551e626ddcbb063abb (diff)
parent12fc8f66e7756a46b816b71de83f856e7ba018ae (diff)
downloadphp-git-818eb8f6113c53cad40ffb4ba19de30429dfe475.tar.gz
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #80226: imap_sort() leaks sortpgm memory
-rw-r--r--NEWS1
-rw-r--r--ext/imap/php_imap.c1
-rw-r--r--ext/imap/tests/bug80226.phpt13
3 files changed, 15 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 86d1f2994d..883ec6e120 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP NEWS
(cmb)
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
(cmb)
+ . Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
- Opcache:
. Fixed bug #80184 (Complex expression in while / if statements resolves to
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 94b84fbe96..33a73de2a7 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -2742,6 +2742,7 @@ PHP_FUNCTION(imap_sort)
slst = mail_sort(imap_le_struct->imap_stream, (charset ? ZSTR_VAL(charset) : NIL), spg, mypgm, flags);
+ mail_free_sortpgm(&mypgm);
if (spg && !(flags & SE_FREE)) {
mail_free_searchpgm(&spg);
}
diff --git a/ext/imap/tests/bug80226.phpt b/ext/imap/tests/bug80226.phpt
new file mode 100644
index 0000000000..95ec235178
--- /dev/null
+++ b/ext/imap/tests/bug80226.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #80226 (imap_sort() leaks sortpgm memory)
+--SKIPIF--
+<?php
+require_once(__DIR__.'/skipif.inc');
+?>
+--FILE--
+<?php
+require_once(__DIR__.'/imap_include.inc');
+$stream = imap_open($default_mailbox, $username, $password);
+imap_sort($stream, SORTFROM, 0);
+?>
+--EXPECT--