Skip to content

Commit 01de000

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix double free when socket_accept fails
2 parents d637f0d + 800cf5a commit 01de000

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/sockets/sockets.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ static int php_accept_connect(php_socket *in_sock, php_socket *out_sock, struct
272272

273273
if (IS_INVALID_SOCKET(out_sock)) {
274274
PHP_SOCKET_ERROR(out_sock, "unable to accept incoming connection", errno);
275-
efree(out_sock);
276275
return 0;
277276
}
278277

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
socket_accept() failure
3+
--FILE--
4+
<?php
5+
6+
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
7+
var_dump(socket_accept($socket));
8+
9+
?>
10+
--EXPECTF--
11+
Warning: socket_accept(): unable to accept incoming connection [%d]: %s in %s on line %d
12+
bool(false)

0 commit comments

Comments
 (0)