Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jul 2002 08:20:42 +0100
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Mike Makonnen <makonnen@pacbell.net>
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>
In-Reply-To: <20020707152851.3ddc58dc.makonnen@pacbell.net>
References:  <20020707152851.3ddc58dc.makonnen@pacbell.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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