From owner-freebsd-audit Mon Nov 25 4:21:46 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A91937B401 for ; Mon, 25 Nov 2002 04:21:45 -0800 (PST) Received: from cognet.ci0.org (cognet.ci0.org [80.65.224.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06E6143E88 for ; Mon, 25 Nov 2002 04:21:44 -0800 (PST) (envelope-from doginou@cognet.ci0.org) Received: from cognet.ci0.org (cognet.ci0.org [80.65.224.102] (may be forged)) by cognet.ci0.org (8.12.6/8.12.6) with ESMTP id gAPCHsFn011752; Mon, 25 Nov 2002 13:17:54 +0100 (CET) (envelope-from doginou@cognet.ci0.org) Received: (from doginou@localhost) by cognet.ci0.org (8.12.6/8.12.6/Submit) id gAPCHl5x011751; Mon, 25 Nov 2002 13:17:47 +0100 (CET) Date: Mon, 25 Nov 2002 13:17:47 +0100 From: Olivier Houchard To: Bruce Evans Cc: freebsd-audit@FreeBSD.ORG Subject: Re: do_dup patch Message-ID: <20021125121747.GA11569@ci0.org> References: <20021125110902.GA10961@ci0.org> <20021125225927.O56791-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021125225927.O56791-100000@gamplex.bde.org> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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