tony2001 Sun Feb 25 22:59:33 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/sockets sockets.c
Log:
MFH: zerofill socket structs
http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.7&r2=1.171.2.9.2.8&diff_format=u
Index: php-src/ext/sockets/sockets.c
diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.7
php-src/ext/sockets/sockets.c:1.171.2.9.2.8
--- php-src/ext/sockets/sockets.c:1.171.2.9.2.7 Wed Jan 10 15:25:07 2007
+++ php-src/ext/sockets/sockets.c Sun Feb 25 22:59:32 2007
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.171.2.9.2.7 2007/01/10 15:25:07 bjori Exp $ */
+/* $Id: sockets.c,v 1.171.2.9.2.8 2007/02/25 22:59:32 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1118,6 +1118,8 @@
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_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 @@
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));
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php