Skip to content

Commit f815310

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 820037d + 4e23d39 commit f815310

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4607,7 +4607,7 @@ PHP_FUNCTION(mb_send_mail)
46074607
smart_str str = {0};
46084608
bool empty = true;
46094609

4610-
if (str_headers != NULL) {
4610+
if (str_headers != NULL && ZSTR_LEN(str_headers) > 0) {
46114611
/* Strip trailing CRLF from `str_headers`; we will add CRLF back if necessary */
46124612
size_t len = ZSTR_LEN(str_headers);
46134613
if (ZSTR_VAL(str_headers)[len-1] == '\n') {

ext/mbstring/tests/gh16229.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
GH-16229 (Address overflowed in ext/mbstring/mbstring.c:4613 #16229)
3+
--EXTENSIONS--
4+
mbstring
5+
--INI--
6+
sendmail_path={MAIL:{PWD}/mb_send_mail_gh16229.eml}
7+
mail.add_x_header=off
8+
--SKIPIF--
9+
<?php
10+
if (!function_exists("mb_send_mail") || !mb_language("japanese")) {
11+
die("skip mb_send_mail() not available");
12+
}
13+
?>
14+
--FILE--
15+
<?php
16+
try {
17+
$a = false;
18+
mb_send_mail($a,$a,$a,$a,$a);
19+
} catch (Exception $e) {
20+
}
21+
?>
22+
--CLEAN--
23+
<?php
24+
@unlink(__DIR__ . "/mb_send_mail_gh16229.eml");
25+
?>
26+
--EXPECTF--

0 commit comments

Comments
 (0)