mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-13603 ext/sockets: properly initialised address info data.
Led to random characters visible on socket id on macOs. Close GH-13606
This commit is contained in:
parent
33967aef11
commit
e3f0d03452
3 changed files with 21 additions and 2 deletions
4
NEWS
4
NEWS
|
@ -16,6 +16,10 @@ PHP NEWS
|
|||
. Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with
|
||||
unknown modes). (timwolla)
|
||||
|
||||
- Sockets:
|
||||
. Fixed bug GH-13604 (socket_getsockname returns random characters in the
|
||||
end of the socket name). (David Carlier)
|
||||
|
||||
- SPL:
|
||||
. Fixed bug GH-13531 (Unable to resize SplfixedArray after being unserialized
|
||||
in PHP 8.2.15). (nielsdos)
|
||||
|
|
|
@ -917,7 +917,7 @@ PHP_FUNCTION(socket_read)
|
|||
PHP_FUNCTION(socket_getsockname)
|
||||
{
|
||||
zval *arg1, *addr, *port = NULL;
|
||||
php_sockaddr_storage sa_storage;
|
||||
php_sockaddr_storage sa_storage = {0};
|
||||
php_socket *php_sock;
|
||||
struct sockaddr *sa;
|
||||
struct sockaddr_in *sin;
|
||||
|
@ -994,7 +994,7 @@ PHP_FUNCTION(socket_getsockname)
|
|||
PHP_FUNCTION(socket_getpeername)
|
||||
{
|
||||
zval *arg1, *arg2, *arg3 = NULL;
|
||||
php_sockaddr_storage sa_storage;
|
||||
php_sockaddr_storage sa_storage = {0};
|
||||
php_socket *php_sock;
|
||||
struct sockaddr *sa;
|
||||
struct sockaddr_in *sin;
|
||||
|
|
15
ext/sockets/tests/gh13603.phpt
Normal file
15
ext/sockets/tests/gh13603.phpt
Normal file
|
@ -0,0 +1,15 @@
|
|||
--TEST--
|
||||
GH-13603 - socket_getsockname - invalid characters
|
||||
--EXTENSIONS--
|
||||
sockets
|
||||
--FILE--
|
||||
<?php
|
||||
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
||||
socket_bind($socket, 'sn.socp');
|
||||
socket_listen($socket);
|
||||
socket_getsockname($socket, $address);
|
||||
var_dump($address);
|
||||
socket_close($socket);
|
||||
unlink($address);
|
||||
--EXPECT--
|
||||
string(7) "sn.socp"
|
Loading…
Add table
Add a link
Reference in a new issue