Skip to content

Fix GH-13603 ext/sockets: properly initialised address info data. #13606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/sockets/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions ext/sockets/tests/gh13603.phpt
Original file line number Diff line number Diff line change
@@ -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"