Skip to content

Commit 10dbdc5

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 33fab73 + f12e496 commit 10dbdc5

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ PHP NEWS
4141
. Fixed bug GH-16385 (Unexpected null returned by session_set_cookie_params).
4242
(nielsdos)
4343

44+
- Sockets:
45+
. Fixed bug with overflow socket_recvfrom $length argument. (David Carlier)
46+
4447
- SPL:
4548
. Fixed bug GH-16337 (Use-after-free in SplHeap). (nielsdos)
4649

ext/sockets/sockets.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,8 @@ PHP_FUNCTION(socket_recvfrom)
14521452

14531453
/* overflow check */
14541454
/* Shouldthrow ? */
1455-
if ((arg3 + 2) < 3) {
1455+
1456+
if (arg3 <= 0 || arg3 > ZEND_LONG_MAX - 1) {
14561457
RETURN_FALSE;
14571458
}
14581459

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
socket_recvfrom overflow on length argument
3+
--EXTENSIONS--
4+
sockets
5+
--SKIPIF--
6+
<?php
7+
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
8+
die('skip not valid for Windows.');
9+
}
10+
--FILE--
11+
<?php
12+
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0);
13+
$buf = $end = "";
14+
var_dump(socket_recvfrom($s, $buf, PHP_INT_MAX, 0, $end));
15+
var_dump(socket_recvfrom($s, $buf, -1, 0, $end));
16+
?>
17+
--EXPECT--
18+
bool(false)
19+
bool(false)

0 commit comments

Comments
 (0)