diff options
author | 2001-08-18 22:56:22 +0000 | |
---|---|---|
committer | 2001-08-18 22:56:22 +0000 | |
commit | 0c24db8133b270a00f48cbabd4e4df5a28973793 (patch) | |
tree | 6c4bf87d07e425ab0011df7f157588a184c61af3 /lib/libc/gen/syslog.c | |
parent | compiles (diff) | |
download | wireguard-openbsd-0c24db8133b270a00f48cbabd4e4df5a28973793.tar.xz wireguard-openbsd-0c24db8133b270a00f48cbabd4e4df5a28973793.zip |
deal with -1 from snprintf, if it ever happens
Diffstat (limited to 'lib/libc/gen/syslog.c')
-rw-r--r-- | lib/libc/gen/syslog.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index b33a663e406..fa6b9511921 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: syslog.c,v 1.10 2001/06/27 00:58:54 lebel Exp $"; +static char rcsid[] = "$OpenBSD: syslog.c,v 1.11 2001/08/18 22:56:22 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -142,7 +142,9 @@ vsyslog(pri, fmt, ap) #define DEC() \ do { \ - if (prlen >= tbuf_left) \ + if (prlen < 0) \ + prlen = 0; \ + else if (prlen >= tbuf_left) \ prlen = tbuf_left - 1; \ p += prlen; \ tbuf_left -= prlen; \ |