lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1175276825.23146.1.camel@w-sridhar2.beaverton.ibm.com>
Date:	Fri, 30 Mar 2007 10:47:04 -0700
From:	Sridhar Samudrala <sri@...ibm.com>
To:	YOSHIFUJI Hideaki /
	 吉藤英明 
	<yoshfuji@...ux-ipv6.org>
Cc:	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH][IPv6]: Fix incorrect length check in rawv6_sendmsg()

On Fri, 2007-03-30 at 09:13 +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> In article <20070329.142644.70222545.davem@...emloft.net> (at Thu, 29 Mar 2007 14:26:44 -0700 (PDT)), David Miller <davem@...emloft.net> says:
> 
> > From: Sridhar Samudrala <sri@...ibm.com>
> > 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.
> 
> Don't you think so?
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>

Acked-by: Sridhar Samudrala <sri@...ibm.com>

> 
> 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;
> 
> --yoshfuji
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ