From owner-freebsd-current Sun Jul 7 15:29: 4 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B05737B400 for ; Sun, 7 Jul 2002 15:29:01 -0700 (PDT) Received: from mta7.pltn13.pbi.net (mta7.pltn13.pbi.net [64.164.98.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49E7143E09 for ; Sun, 7 Jul 2002 15:29:01 -0700 (PDT) (envelope-from mtm@pacbell.net) Received: from kokeb.ambesa.net ([64.166.87.35]) by mta7.pltn13.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GYW007NDH4C2O@mta7.pltn13.pbi.net> for freebsd-current@freebsd.org; Sun, 07 Jul 2002 15:29:00 -0700 (PDT) Received: from kokeb.ambesa.net (tanstaafl@localhost [IPv6:::1]) by kokeb.ambesa.net (8.12.5/8.12.5) with ESMTP id g67MSrVb005279 for ; Sun, 07 Jul 2002 15:28:53 -0700 Received: (from mtm@localhost) by kokeb.ambesa.net (8.12.5/8.12.5/Submit) id g67MSpZx005278; Sun, 07 Jul 2002 15:28:51 -0700 (PDT) Date: Sun, 07 Jul 2002 15:28:51 -0700 From: Mike Makonnen Subject: benign bug in src/sys/kern/kern_resource.c:limcopy() ? To: freebsd-current@freebsd.org Message-id: <20020707152851.3ddc58dc.makonnen@pacbell.net> MIME-version: 1.0 X-Mailer: Sylpheed version 0.7.8 (GTK+ 1.2.10; i386-portbld-freebsd5.0) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello folks, The limcopy() function bcopy()s a struct rlimit, but the len argument to bcopy() is given as sizeof(struct plimit). This hasn't caused any problems so far because the destination address is the first member of struct plimit and all the other member of plimit are initialized immediately thereafter. The patch follows. Cheers, Mike Makonnen Index: sys/kern/kern_resource.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_resource.c,v retrieving revision 1.106 diff -u -r1.106 kern_resource.c --- sys/kern/kern_resource.c 29 Jun 2002 02:00:01 -0000 1.106 +++ sys/kern/kern_resource.c 7 Jul 2002 22:01:54 -0000 @@ -811,7 +811,7 @@ MALLOC(copy, struct plimit *, sizeof(struct plimit), M_SUBPROC, M_WAITOK); - bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct plimit)); + bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct rlimit)); copy->p_lflags = 0; copy->p_refcnt = 1; return (copy); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message