[PATCH] unix domain sockets bugfix

From: Balazs Scheidler (bazsi@balabit.hu)
Date: Mon Oct 07 2002 - 02:35:32 EST


Hi,

I've found a bug with unix domain sockets in both kernels 2.2 and 2.4.
If the program issues a recvfrom() on a SOCK_DGRAM socket, and the sender
had no name, the sockaddr returned is not filled in.

The returned socklen is 2, but the sockaddr.family is not touched. A fix is
below:

--- af_unix.c~ Mon Feb 25 20:38:16 2002
+++ af_unix.c Fri Oct 4 09:46:26 2002
@@ -1392,6 +1392,9 @@
                        sk->protinfo.af_unix.addr->name,
                        sk->protinfo.af_unix.addr->len);
         }
+ else {
+ ((struct sockaddr *) msg->msg_name)->sa_family = AF_UNIX;
+ }
 }
 
 static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, int size,

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:57 EST