Merge branch 'PHP-8.4'

This commit is contained in:
David Carlier 2024-10-12 15:24:53 +01:00
commit 35c8a010c6
No known key found for this signature in database
GPG key ID: 8486F847B4B94EF1
2 changed files with 21 additions and 1 deletions

View file

@ -1452,7 +1452,8 @@ PHP_FUNCTION(socket_recvfrom)
/* overflow check */ /* overflow check */
/* Shouldthrow ? */ /* Shouldthrow ? */
if ((arg3 + 2) < 3) {
if (arg3 <= 0 || arg3 > ZEND_LONG_MAX - 1) {
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -0,0 +1,19 @@
--TEST--
socket_recvfrom overflow on length argument
--EXTENSIONS--
sockets
--SKIPIF--
<?php
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
die('skip not valid for Windows.');
}
--FILE--
<?php
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0);
$buf = $end = "";
var_dump(socket_recvfrom($s, $buf, PHP_INT_MAX, 0, $end));
var_dump(socket_recvfrom($s, $buf, -1, 0, $end));
?>
--EXPECT--
bool(false)
bool(false)