diff options
author | 1999-01-10 01:45:31 +0000 | |
---|---|---|
committer | 1999-01-10 01:45:31 +0000 | |
commit | 67e6ab94f383f354c531f7628b8311fed2a80a70 (patch) | |
tree | ec9cef23e2e809e222745684d07c6185cb5a4458 /sys/kern/subr_prf.c | |
parent | behave reasonably if malloc fails (diff) | |
download | wireguard-openbsd-67e6ab94f383f354c531f7628b8311fed2a80a70.tar.xz wireguard-openbsd-67e6ab94f383f354c531f7628b8311fed2a80a70.zip |
NUL terminate the buffer in vsprintf
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 641dd90fa88..4f1fab02321 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.23 1998/04/04 18:36:32 deraadt Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.24 1999/01/10 01:45:31 niklas Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -569,13 +569,15 @@ vsprintf(buf, fmt, ap) va_list ap; { int savintr; + int len; savintr = consintr; /* disable interrupts */ consintr = 0; - kprintf(fmt, TOBUFONLY, NULL, buf, ap); + len = kprintf(fmt, TOBUFONLY, NULL, buf, ap); if (!panicstr) logwakeup(); consintr = savintr; /* reenable interrupts */ + buf[len] = 0; return (0); } |