mirror of
https://github.com/php/php-src.git
synced 2025-01-22 11:44:09 +08:00
MFH: zerofill socket structs
This commit is contained in:
parent
d3ddf47718
commit
b42addcc54
@ -1118,6 +1118,8 @@ PHP_FUNCTION(socket_connect)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET6 requires 3 arguments");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
memset(&sin6, 0, sizeof(struct sockaddr_in6));
|
||||
|
||||
sin6.sin6_family = AF_INET6;
|
||||
sin6.sin6_port = htons((unsigned short int)port);
|
||||
@ -1134,6 +1136,8 @@ PHP_FUNCTION(socket_connect)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET requires 3 arguments");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
memset(&sin, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_port = htons((unsigned short int)port);
|
||||
@ -1146,6 +1150,8 @@ PHP_FUNCTION(socket_connect)
|
||||
break;
|
||||
|
||||
case AF_UNIX:
|
||||
memset(&s_un, 0, sizeof(struct sockaddr_un));
|
||||
|
||||
s_un.sun_family = AF_UNIX;
|
||||
snprintf(s_un.sun_path, 108, "%s", addr);
|
||||
retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
||||
|
Loading…
Reference in New Issue
Block a user