summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2005-01-04 18:30:39 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2005-01-04 18:30:39 +0000
commitefb8108c29d5fb4e1aefad1976961c0e22786609 (patch)
tree9f3d9e14a601a8655976f247b916322ea552b146
parent5d9aaa7c020aefb8a2e55569b8ea851ad9dd9a94 (diff)
add snprintf sanity check.
ok millert@, henning@
-rw-r--r--usr.bin/cdio/cdio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c
index 0ba3379a0b7..b36c1dc6fd3 100644
--- a/usr.bin/cdio/cdio.c
+++ b/usr.bin/cdio/cdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cdio.c,v 1.35 2004/09/14 22:21:30 deraadt Exp $ */
+/* $OpenBSD: cdio.c,v 1.36 2005/01/04 18:30:38 moritz Exp $ */
/* Copyright (c) 1995 Serge V. Vakulenko
* All rights reserved.
@@ -263,7 +263,7 @@ main(int argc, char **argv)
len = snprintf(p, buf + sizeof buf - p,
"%s%s", (p > buf) ? " " : "", *argv);
- if (len >= buf + sizeof buf - p)
+ if (len == -1 || len >= buf + sizeof buf - p)
errx(1, "argument list too long.");
p += len;