PHP 4.0 Bug #9920: clearing sun_family when binding to AF_UNIX socket
| From: | jack at mobil dot cz | Date: | Thu, 22 Mar 2001 13:06:35 +0000 |
| Subject: | PHP 4.0 Bug #9920: clearing sun_family when binding to AF_UNIX socket | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-49734@lists.php.net to get a copy of this message | ||
From: jack@mobil.cz
Operating system: All
PHP version: 4.0.4pl1
PHP Bug Type: Sockets related
Bug description: clearing sun_family when binding to AF_UNIX socket
patch is as easy as this:
diff -uNr php-4.0.4pl1/ext/sockets/sockets.c php-4.0.4pl1-patched/ext/sockets/sockets.c
--- php-4.0.4pl1/ext/sockets/sockets.c Tue Dec 12 18:09:40 2000
+++ php-4.0.4pl1-patched/ext/sockets/sockets.c Mon Jan 22 14:01:47 2001
@@ -1119,6 +1119,7 @@
if (sock_type->sa_family == AF_UNIX) {
struct sockaddr_un *sa = (struct sockaddr_un *) sock_type;
memset(sa, 0, sizeof(sa_storage)); /* This is safe -> sock_type = &sa_storage -> sa =
sock_type */
+ sa->sun_family = AF_UNIX;
snprintf(sa->sun_path, 108, "%s", Z_STRVAL_PP(arg1));
ret = bind(Z_LVAL_PP(arg0), (struct sockaddr *) sa, SUN_LEN(sa));
} else if (sock_type->sa_family == AF_INET) {
--
Edit Bug report at: http://bugs.php.net/?id=9920&edit=1