Skip to content

Commit 78bffa7

Browse files
committed
Fix null pointer deref in qprint-encode filter (bug #77231)
1 parent 48f0f73 commit 78bffa7

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2018, PHP 5.6.39
44

5+
- Core:
6+
. Fixed bug #77231 (Segfault when using convert.quoted-printable-encode
7+
filter). (Stas)
8+
59
- IMAP:
610
. Fixed bug #77020 (null pointer dereference in imap_mail). (cmb)
711
. Fixed bug #77153 (imap_open allows to run arbitrary shell commands via

ext/standard/filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
928928
line_ccnt--;
929929
CONSUME_CHAR(ps, icnt, lb_ptr, lb_cnt);
930930
} else {
931-
if (line_ccnt < 4) {
931+
if (line_ccnt < 4 && inst->lbchars != NULL) {
932932
if (ocnt < inst->lbchars_len + 1) {
933933
err = PHP_CONV_ERR_TOO_BIG;
934934
break;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
Bug #77231 (Segfault when using convert.quoted-printable-encode filter)
3+
--FILE--
4+
<?php
5+
var_dump(file(urldecode('php://filter/convert.quoted-printable-encode/resource=data://,%bfAAAAAAAAFAAAAAAAAAAAAAA%ff%ff%ff%ff%ff%ff%ff%ffAAAAAAAAAAAAAAAAAAAAAAAA')));
6+
?>
7+
--EXPECT--
8+
array(1) {
9+
[0]=>
10+
string(74) "=BFAAAAAAAAFAAAAAAAAAAAAAA=FF=FF=FF=FF=FF=FF=FF=FFAAAAAAAAAAAAAAAAAAAAAAAA"
11+
}

0 commit comments

Comments
 (0)