Skip to content

Commit 12fc8f6

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #80226: imap_sort() leaks sortpgm memory
2 parents 74cf2eb + 8488c34 commit 12fc8f6

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
@@ -21,6 +21,7 @@ PHP NEWS
2121
(cmb)
2222
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
2323
(cmb)
24+
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
2425

2526
- MySQLnd:
2627
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with

ext/imap/php_imap.c

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

32023202
slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL));
32033203

3204+
mail_free_sortpgm(&mypgm);
32043205
if (spg && !(flags & SE_FREE)) {
32053206
mail_free_searchpgm(&spg);
32063207
}

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)