Skip to content

Commit 35c8a01

Browse files
committed
Merge branch 'PHP-8.4'
2 parents 40052b3 + 10dbdc5 commit 35c8a01

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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)