diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-03-08 15:41:04 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-03-08 15:41:04 +0000 |
commit | c6b26661832d420798bd4380212eb35d7c7aa0c0 (patch) | |
tree | bde61376b0a297980a488465555e0769414453d6 /lib/libc | |
parent | 31041a4c8166889360cf76d3796547621f3dd5a6 (diff) |
handle snprintf() returning -1.
ok cloder@ henning@ hshoexer@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/syslog.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c index 890209055f0..fdd10b76b9d 100644 --- a/lib/libc/gen/syslog.c +++ b/lib/libc/gen/syslog.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: syslog.c,v 1.26 2004/05/18 02:05:52 jfb Exp $"; +static char rcsid[] = "$OpenBSD: syslog.c,v 1.27 2005/03/08 15:41:03 moritz Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -204,6 +204,8 @@ vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) prlen = snprintf(t, fmt_left, "Error %d", saved_errno); } + if (prlen < 0) + prlen = 0; if (prlen >= fmt_left) prlen = fmt_left - 1; t += prlen; |