Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2002 13:17:47 +0100
From:      Olivier Houchard <cognet@ci0.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        freebsd-audit@FreeBSD.ORG
Subject:   Re: do_dup patch
Message-ID:  <20021125121747.GA11569@ci0.org>
In-Reply-To: <20021125225927.O56791-100000@gamplex.bde.org>
References:  <20021125110902.GA10961@ci0.org> <20021125225927.O56791-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 25, 2002 at 11:07:53PM +1100, Bruce Evans wrote:
> On Mon, 25 Nov 2002, Olivier Houchard wrote:
> 
> I just added the bounds checks.  Cleaning up the prototypes can wait.
> (There are hundreds of other wrong prototypes their anyway, most involving
> use of "int" or "u_int" instead of foo_t or not using "const".)
> 
> This has not been tested at runtime.
> 
> %%%
> Index: kern_descrip.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v
> retrieving revision 1.168
> diff -u -2 -r1.168 kern_descrip.c
> --- kern_descrip.c	27 Oct 2002 18:07:41 -0000	1.168
> +++ kern_descrip.c	25 Nov 2002 11:56:27 -0000
> @@ -471,6 +475,6 @@
>  	 */
>  	FILEDESC_LOCK(fdp);
> -	if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL ||
> -	    new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
> +	if (old < 0 || old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL ||
> +	    new < 0 || new >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur ||
>  	    new >= maxfilesperproc) {
>  		FILEDESC_UNLOCK(fdp);
> %%%

I just tested the same change and it is ok.
Shall I submit it to re@ or will you do it ?

Olivier

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




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