summaryrefslogtreecommitdiff
path: root/sbin/modunload
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 16:06:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-18 16:06:44 +0000
commit31cbabfe8d692932cd09f237079b28ae57f6ccc1 (patch)
tree5b7268690c009bbcababbb47a5167d9394046dc2 /sbin/modunload
parent18406398470a48262fa0f68abd8e85170c31f764 (diff)
better strtol() checking
Diffstat (limited to 'sbin/modunload')
-rw-r--r--sbin/modunload/modunload.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/modunload/modunload.c b/sbin/modunload/modunload.c
index abffb35e49f..47634120dfe 100644
--- a/sbin/modunload/modunload.c
+++ b/sbin/modunload/modunload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modunload.c,v 1.6 1998/11/18 10:43:04 art Exp $ */
+/* $OpenBSD: modunload.c,v 1.7 1998/11/18 16:06:43 deraadt Exp $ */
/* $NetBSD: modunload.c,v 1.9 1995/05/28 05:23:05 jtc Exp $ */
/*
@@ -81,7 +81,8 @@ main(argc, argv)
switch (c) {
case 'i':
modnum = strtol(optarg, &endptr, 0);
- if (*endptr != '\0')
+ if (modnum == LONG_MIN || modnum == LONG_MAX ||
+ *endptr != '\0')
errx(1, "not a valid number");
break; /* number */
case 'n':