From owner-freebsd-current Mon Jul 8 0:20:51 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 CB39037B401 for ; Mon, 8 Jul 2002 00:20:48 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 5074643E4A for ; Mon, 8 Jul 2002 00:20:47 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 8 Jul 2002 08:20:46 +0100 (BST) Date: Mon, 8 Jul 2002 08:20:42 +0100 From: David Malone To: Mike Makonnen Cc: freebsd-current@freebsd.org Subject: Re: benign bug in src/sys/kern/kern_resource.c:limcopy() ? Message-ID: <20020708072042.GA49370@walton.maths.tcd.ie> References: <20020707152851.3ddc58dc.makonnen@pacbell.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020707152851.3ddc58dc.makonnen@pacbell.net> User-Agent: Mutt/1.3.25i 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 On Sun, Jul 07, 2002 at 03:28:51PM -0700, Mike Makonnen wrote: > 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)); Since pl_rlimit is an array of struct rlimits, don't we want: bcopy(lim->pl_rlimit, copy->pl_rlimit, sizeof(struct rlimit)*RLIM_NLIMITS); or maybe: bcopy(&(lim->pl_rlimit[0]), &(copy->pl_rlimit[0]), sizeof(lim->pl_rlimit)); rather than just copying the first limit? It might be better to just bcopy the whole struct plimit and make a note that other fields need to be reset. David. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message