kernel not zeroing sipx_zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is a single padding byte at the end of each sockaddr_ipx. This
byte is not initialised by the kernel (in 2.6.8.1 at least) when
returning IPX addresses in recvmsg or getpeername (& variants); so the
kernel sometimes leaks out non-zero values in this byte. I noticed this
while writing a program which was comparing addresses returned by
recvfrom; it was getting false negatives.

The following patch zeroes the padding byte in ipx_getname and
ipx_recvmsg. I think this fixes all the cases.

--- official/net/ipx/af_ipx.c	2004-07-25 16:59:33.000000000 +0100
+++ linux/net/ipx/af_ipx.c	2004-09-26 16:45:40.000000000 +0100
@@ -1621,6 +1621,7 @@ static int ipx_getname(struct socket *so
 
 	sipx.sipx_family = AF_IPX;
 	sipx.sipx_type	 = ipxs->type;
+	sipx.sipx_zero	 = 0;
 	memcpy(uaddr, &sipx, sizeof(sipx));
 
 	rc = 0;
@@ -1808,6 +1809,7 @@ static int ipx_recvmsg(struct kiocb *ioc
 		memcpy(sipx->sipx_node, ipx->ipx_source.node, IPX_NODE_LEN);
 		sipx->sipx_network	= IPX_SKB_CB(skb)->ipx_source_net;
 		sipx->sipx_type 	= ipx->ipx_type;
+		sipx->sipx_zero 	= 0;
 	}
 	rc = copied;
 

-
Colin Phipps <cph@cph.demon.co.uk>
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux