2.4.0-test1-ac8: recvfrom() bug

From: Frank van Maarseveen (F.vanMaarseveen@inter.NL.net)
Date: Mon Jun 05 2000 - 17:53:16 EST


A small fix from me for 2.2.14 didn't make it into 2.3.x/2.4.0-test1.
To recall:

        ... tracking down a possible bug in RH6.1 routed daemon. It does a

                recvfrom(fd, &inbuf, sizeof (inbuf), 0, &from, &fromlen)

        and it appears that even when `from' is cleared in advance the from->sa_data
        contains not only a 2 byte port number + source IP but also some trailing
        garbage afterwards ...

Here is the fix for 2.4.0-test1-ac8:
--- linux/net/ipv4/udp.c.orig Wed May 3 10:48:03 2000
+++ linux/net/ipv4/udp.c Tue Jun 6 00:12:09 2000
@@ -715,12 +715,13 @@
         /* Copy the address. */
         if (sin)
         {
                 sin->sin_family = AF_INET;
                 sin->sin_port = skb->h.uh->source;
                 sin->sin_addr.s_addr = skb->nh.iph->saddr;
+ memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
           }
         if (sk->protinfo.af_inet.cmsg_flags)
                 ip_cmsg_recv(msg, skb);
         err = copied;
   
 out_free:

-- 
Frank

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jun 07 2000 - 21:00:23 EST