summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 23:26:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 23:26:14 +0000
commit907c21b6251939fe5065711d48e130e7a75c2f5a (patch)
tree99c562091ffca64d7068911c4f8ce18abba9578d
parent30e2ab17e7a46c8d7c3b18eeefd86f7034f00ae7 (diff)
strtol() range check
-rw-r--r--bin/stty/cchar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/stty/cchar.c b/bin/stty/cchar.c
index 05afe92fbb5..16db3d8f4ca 100644
--- a/bin/stty/cchar.c
+++ b/bin/stty/cchar.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cchar.c,v 1.7 1997/09/01 18:30:31 deraadt Exp $ */
+/* $OpenBSD: cchar.c,v 1.8 1998/11/18 23:26:13 deraadt Exp $ */
/* $NetBSD: cchar.c,v 1.10 1996/05/07 18:20:05 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cchar.c 8.5 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: cchar.c,v 1.7 1997/09/01 18:30:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cchar.c,v 1.8 1998/11/18 23:26:13 deraadt Exp $";
#endif
#endif /* not lint */
@@ -126,7 +126,7 @@ csearch(argvp, ip)
ip->t.c_cc[cp->sub] = _POSIX_VDISABLE;
else if (cp->sub == VMIN || cp->sub == VTIME) {
val = strtol(arg, &ep, 10);
- if (val > UCHAR_MAX) {
+ if (val > UCHAR_MAX || val < 0) {
warnx("maximum option value is %d -- %s",
UCHAR_MAX, name);
usage();