summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoda <joda@NetBSD.org>2001-09-17 10:05:57 +0000
committerjoda <joda@NetBSD.org>2001-09-17 10:05:57 +0000
commitf51bc9e68bf01ca9861543da613be76b27ba19ef (patch)
tree883100460ae87e7087cfb15f0f7a1d9feca1075a
parent151ad65334ffe3ae318e12d3334010ab3f6e7404 (diff)
use strtol instead of atoi to catch non numeric values
-rw-r--r--usr.sbin/pcictl/pcictl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/pcictl/pcictl.c b/usr.sbin/pcictl/pcictl.c
index 9d57212b289..e418dc82958 100644
--- a/usr.sbin/pcictl/pcictl.c
+++ b/usr.sbin/pcictl/pcictl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pcictl.c,v 1.3 2001/09/15 18:35:00 thorpej Exp $ */
+/* $NetBSD: pcictl.c,v 1.4 2001/09/17 10:05:57 joda Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -231,12 +231,18 @@ cmd_dump(int argc, char *argv[])
int
parse_bdf(const char *str)
{
+ long value;
+ char *end;
if (strcmp(str, "all") == 0 ||
strcmp(str, "any") == 0)
return (-1);
- return (atoi(str));
+ value = strtol(str, &end, 0);
+ if(*end != '\0')
+ errx(1, "\"%s\" is not a number", str);
+
+ return value;
}
void