summaryrefslogtreecommitdiff
path: root/usr.bin/sort/init.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-11 07:12:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-04-11 07:12:04 +0000
commit7fcabc06b5d02ebca8a0b0ebdc964034c51df4a7 (patch)
treef725e9aeaadfde05995c71a8eb6a41dc1f486ca2 /usr.bin/sort/init.c
parent1689893fc119a23437cdf4ee9d2ffdf3b518ea54 (diff)
also handle snprintf returning -1, trivial
Diffstat (limited to 'usr.bin/sort/init.c')
-rw-r--r--usr.bin/sort/init.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/sort/init.c b/usr.bin/sort/init.c
index ac2f07c1803..2cf8c1a9ebd 100644
--- a/usr.bin/sort/init.c
+++ b/usr.bin/sort/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.7 2004/07/20 03:50:27 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.8 2005/04/11 07:12:03 deraadt Exp $ */
/*-
* Copyright (c) 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: init.c,v 1.7 2004/07/20 03:50:27 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.8 2005/04/11 07:12:03 deraadt Exp $";
#endif
#endif /* not lint */
@@ -238,7 +238,7 @@ fixit(int *argc, char **argv)
n = snprintf(bufp, bufend - bufp, "-k%ld%s",
v+1, p);
}
- if (n >= bufend - bufp)
+ if (n == -1 || n >= bufend - bufp)
errx(2, "bad field specification");
bufp += n;
@@ -265,7 +265,7 @@ fixit(int *argc, char **argv)
n = snprintf(bufp, bufend - bufp,
",%ld.%ld%s", w+1, x, p);
}
- if (n >= bufend - bufp)
+ if (n == -1 || n >= bufend - bufp)
errx(2, "bad field specification");
/* shift over argv */