Skip to content

Commit 818eb8f

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #80226: imap_sort() leaks sortpgm memory
2 parents 87beb22 + 12fc8f6 commit 818eb8f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PHP NEWS
1717
(cmb)
1818
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
1919
(cmb)
20+
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
2021

2122
- Opcache:
2223
. Fixed bug #80184 (Complex expression in while / if statements resolves to

ext/imap/php_imap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,7 @@ PHP_FUNCTION(imap_sort)
27422742

27432743
slst = mail_sort(imap_le_struct->imap_stream, (charset ? ZSTR_VAL(charset) : NIL), spg, mypgm, flags);
27442744

2745+
mail_free_sortpgm(&mypgm);
27452746
if (spg && !(flags & SE_FREE)) {
27462747
mail_free_searchpgm(&spg);
27472748
}

ext/imap/tests/bug80226.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #80226 (imap_sort() leaks sortpgm memory)
3+
--SKIPIF--
4+
<?php
5+
require_once(__DIR__.'/skipif.inc');
6+
?>
7+
--FILE--
8+
<?php
9+
require_once(__DIR__.'/imap_include.inc');
10+
$stream = imap_open($default_mailbox, $username, $password);
11+
imap_sort($stream, SORTFROM, 0);
12+
?>
13+
--EXPECT--

0 commit comments

Comments
 (0)