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] [thread-next>] [day] [month] [year] [list]
Message-Id: <1156447974.5629.54.camel@localhost>
Date:	Thu, 24 Aug 2006 15:32:54 -0400
From:	Trond Myklebust <trond.myklebust@....uio.no>
To:	David Howells <dhowells@...hat.com>
Cc:	torvalds@...l.org, akpm@...l.org, aviro@...hat.com,
	steved@...hat.com, linux-kernel@...r.kernel.org,
	nfsv4@...ux-nfs.org
Subject: Re: [PATCH] NFS: Check lengths more thoroughly in NFS4 readdir XDR
	decode

On Thu, 2006-08-24 at 19:35 +0100, David Howells wrote:
> So, what you've done is:
> 
> -+		if (end - p < xlen)
> ++		if (end - p < xlen + 1)
>   			goto short_pkt;
>  +		dprintk("filename = %*s\n", len, (char *)p);
>  +		p += xlen;
>   		len = ntohl(*p++);	/* bitmap length */
>  -		p += len;
>  -		if (p + 1 > end)
> -+		if (end - p < len)
> ++		if (end - p < len + 1)
>   			goto short_pkt;
>  +		p += len;
>   		attrlen = XDR_QUADLEN(ntohl(*p++));
>  -		p += attrlen;		/* attributes */
>  -		if (p + 2 > end)
> -+		if (end - p < attrlen + 1)
> ++		if (end - p < attrlen + 2)
> 
> But is this equivalent:
> 
> -+		if (end - p < xlen)
> ++		if (end - p <= xlen)
>   			goto short_pkt;
>  +		dprintk("filename = %*s\n", len, (char *)p);
>  +		p += xlen;
>   		len = ntohl(*p++);	/* bitmap length */
>  -		p += len;
>  -		if (p + 1 > end)
> -+		if (end - p < len)
> ++		if (end - p <= len)
>   			goto short_pkt;
>  +		p += len;
>   		attrlen = XDR_QUADLEN(ntohl(*p++));
>  -		p += attrlen;		/* attributes */
>  -		if (p + 2 > end)
> -+		if (end - p < attrlen + 1)
> ++		if (end - p <= attrlen + 1)
                              ^^^^^^^^^^^^^^
> 
> Do you think?

No. I find that mixture of < and <= is much less easy to read. Besides,
the compiler should be able to optimise that for me.

Cheers,
  Trond

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ