Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Aug 2002 12:33:27 +0200
From:      Rolf Grossmann <rg@progtech.net>
To:        freebsd-security@FreeBSD.ORG
Subject:   Re: FreeBSD Security Advisory FreeBSD-SA-02:34.rpc
Message-ID:  <3D490E77.6050003@PROGTECH.net>
References:  <200208010246.g712k6NM003336@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

I've been looking at your patch for the rpc buffer overflow and I 
believe it's not sufficient.

You're using:

if ((c > maxsize && UINT_MAX/elsize < c) &&
    (xdrs->x_op != XDR_FREE)) {
	return (FALSE);

but I think it really should test both conditions (the braces suggest that you
actually meant that anyway):

if ((c > maxsize || UINT_MAX/elsize < c) &&
    (xdrs->x_op != XDR_FREE)) {
	return (FALSE);

Otherwise, if the writer of the application using xdr_array specified 
maxsize too large (maybe he didn't care), you're in trouble again. I think
it's clearer if you write the condition the other way round:

if ((c > maxsize || c > UINT_MAX/elsize) &&
    (xdrs->x_op != XDR_FREE)) {
	return (FALSE);

Should I file a PR or am I completely off track here?

Bye, Rolf




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D490E77.6050003>