Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jul 2002 15:28:51 -0700
From:      Mike Makonnen <makonnen@pacbell.net>
To:        freebsd-current@freebsd.org
Subject:   benign bug in src/sys/kern/kern_resource.c:limcopy() ?
Message-ID:  <20020707152851.3ddc58dc.makonnen@pacbell.net>

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




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