Skip to content

Commit 0220731

Browse files
committed
Merge branch 'PHP-8.6'
# Conflicts: # NEWS
2 parents 981c083 + 644b5e8 commit 0220731

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

‎ext/mbstring/mbstring.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,10 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
601601
++pos;
602602
}
603603
} else {
604-
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
605-
604+
size_t len = php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
605+
while (len-- > 0 && *pos) {
606+
++pos;
607+
}
606608
}
607609
}
608610
if (*pos == '\0') {
@@ -614,7 +616,10 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
614616
res = estrndup(*line, pos - *line);
615617

616618
while (*pos == stop) {
617-
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
619+
size_t len = php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
620+
while (len-- > 0 && *pos) {
621+
++pos;
622+
}
618623
}
619624

620625
*line = pos;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Over-read in php_mb_rfc1867_getword() on a multibyte field name (mbstring.encoding_translation=On)
3+
--EXTENSIONS--
4+
mbstring
5+
--POST_RAW--
6+
Content-Type: multipart/form-data; boundary=blah
7+
8+
--blah
9+
Content-Disposition: form-data; name=a×
10+
11+
x
12+
--blah--
13+
--INI--
14+
mbstring.encoding_translation=On
15+
--FILE--
16+
<?php
17+
var_dump(count($_POST));
18+
echo "Done\n";
19+
?>
20+
--EXPECT--
21+
int(1)
22+
Done

0 commit comments

Comments
 (0)