Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b59e139bbd5c789700aa9cefe7eb6590bc516b86
Commit:     b59e139bbd5c789700aa9cefe7eb6590bc516b86
Parent:     31ba548f9683c5c5809567549b404404b6017088
Author:     YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
AuthorDate: Fri Mar 30 14:45:35 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Apr 2 13:30:54 2007 -0700

    [IPv6]: Fix incorrect length check in rawv6_sendmsg()
    
    In article <[EMAIL PROTECTED]> (at Thu, 29 Mar 2007 14:26:44 -0700 (PDT)), 
David Miller <[EMAIL PROTECTED]> says:
    
    > From: Sridhar Samudrala <[EMAIL PROTECTED]>
    > Date: Thu, 29 Mar 2007 14:17:28 -0700
    >
    > > The check for length in rawv6_sendmsg() is incorrect.
    > > As len is an unsigned int, (len < 0) will never be TRUE.
    > > I think checking for IPV6_MAXPLEN(65535) is better.
    > >
    > > Is it possible to send ipv6 jumbo packets using raw
    > > sockets? If so, we can remove this check.
    >
    > I don't see why such a limitation against jumbo would exist,
    > does anyone else?
    >
    > Thanks for catching this Sridhar.  A good compiler should simply
    > fail to compile "if (x < 0)" when 'x' is an unsigned type, don't
    > you think :-)
    
    Dave, we use "int" for returning value,
    so we should fix this anyway, IMHO;
    we should not allow len > INT_MAX.
    
    Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
    Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv6/raw.c |    4 ++--
 net/ipv6/udp.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 306d5d8..203e069 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -687,9 +687,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock 
*sk,
        int err;
 
        /* Rough check on arithmetic overflow,
-          better check is made in ip6_build_xmit
+          better check is made in ip6_append_data().
         */
-       if (len < 0)
+       if (len > INT_MAX)
                return -EMSGSIZE;
 
        /* Mirror BSD error message compatibility */
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0ad4719..f590db5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -615,7 +615,7 @@ do_udp_sendmsg:
                return udp_sendmsg(iocb, sk, msg, len);
 
        /* Rough check on arithmetic overflow,
-          better check is made in ip6_build_xmit
+          better check is made in ip6_append_data().
           */
        if (len > INT_MAX - sizeof(struct udphdr))
                return -EMSGSIZE;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to