diff options
author | dg <dg@FreeBSD.org> | 1995-08-07 07:58:23 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-08-07 07:58:23 +0000 |
commit | fad46e4f97a35f12dc96b526b7d14f3ed00e7e26 (patch) | |
tree | 57e81b8f4f931e9f781013a9db6c6679a7e3f2ec /sys/kern/subr_prf.c | |
parent | d9b109975827973dc12bcc88eff6356d6dd941a6 (diff) | |
download | FreeBSD-src-fad46e4f97a35f12dc96b526b7d14f3ed00e7e26.zip FreeBSD-src-fad46e4f97a35f12dc96b526b7d14f3ed00e7e26.tar.gz |
Made msgbuf range checking more robust and clean.
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 0c0f886..c817d0f 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - * $Id: subr_prf.c,v 1.14 1995/06/14 07:55:07 bde Exp $ + * $Id: subr_prf.c,v 1.15 1995/08/06 22:00:17 davidg Exp $ */ #include <sys/param.h> @@ -504,8 +504,10 @@ putchar(c, flags, tp) if ((flags & TOLOG) && c != '\0' && c != '\r' && c != 0177 && msgbufmapped) { mbp = msgbufp; - if (mbp->msg_magic != MSG_MAGIC) { - bzero((caddr_t)mbp, sizeof(*mbp)); + if (mbp->msg_magic != MSG_MAGIC || + mbp->msg_bufx >= MSG_BSIZE || + mbp->msg_bufr >= MSG_BSIZE) { + bzero(mbp, sizeof(struct msgbuf)); mbp->msg_magic = MSG_MAGIC; } mbp->msg_bufc[mbp->msg_bufx++] = c; |