summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2005-04-28 10:14:27 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2005-04-28 10:14:27 +0000
commit0af93708eb0ddbbcc2e47b8102dd89ac558aced8 (patch)
treecc29895049d835cf1d00508445ddb682acdb1541
parentc3ef1926e1cd5de5065948c171136b0cf36a0485 (diff)
add vsnprintf error checking. ok cloder@ millert@
-rw-r--r--usr.sbin/lpr/lpd/printjob.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index 012400b2ff4..1a9c3221023 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.39 2004/04/14 20:52:20 millert Exp $ */
+/* $OpenBSD: printjob.c,v 1.40 2005/04/28 10:14:26 moritz Exp $ */
/* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */
/*
@@ -1637,6 +1637,8 @@ pstatus(const char *msg, ...)
ftruncate(fd, 0);
len = vsnprintf(buf, sizeof(buf), msg, ap);
va_end(ap);
+ if (len == -1)
+ return;
if (len >= sizeof(buf))
len = sizeof(buf) - 1;
buf[len++] = '\n'; /* replace NUL with newline */