php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9920 clearing sun_family when binding to AF_UNIX socket
Submitted: 2001-03-22 08:06 UTC Modified: 2001-03-22 08:25 UTC
From: jack at mobil dot cz Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.4pl1 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jack at mobil dot cz
New email:
PHP Version: OS:

 

 [2001-03-22 08:06 UTC] jack at mobil dot cz
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) {

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-22 08:25 UTC] sniper@php.net
Fixed in CVS. Thanks for the patch!

--Jani

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jan 02 12:01:29 2025 UTC