diff options
author | deraadt <deraadt@openbsd.org> | 2010-05-31 21:33:04 +0000 |
---|---|---|
committer | deraadt <deraadt@openbsd.org> | 2010-05-31 21:33:04 +0000 |
commit | 48800d7b6ef3f0baa8fb618bc9309a4ae414a687 (patch) | |
tree | 3bc69f5e21e3e9b76be10849bcb7310e3ccecbb5 /usr.sbin/usbdevs | |
parent | Hide the timeout_* macros under an EVENT_DEPRECATED ifdef. These names (diff) | |
download | wireguard-openbsd-48800d7b6ef3f0baa8fb618bc9309a4ae414a687.tar.xz wireguard-openbsd-48800d7b6ef3f0baa8fb618bc9309a4ae414a687.zip |
use strtonum() instead of atoi() to parse the device address
(from 1 - USB_MAX_DEVICES, not 0- as submitted)
from Gleydson Soares
Diffstat (limited to 'usr.sbin/usbdevs')
-rw-r--r-- | usr.sbin/usbdevs/usbdevs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/usbdevs/usbdevs.c b/usr.sbin/usbdevs/usbdevs.c index 24af6e9b7ec..99fc276c90a 100644 --- a/usr.sbin/usbdevs/usbdevs.c +++ b/usr.sbin/usbdevs/usbdevs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.c,v 1.18 2010/04/02 05:46:21 ckuethe Exp $ */ +/* $OpenBSD: usbdevs.c,v 1.19 2010/05/31 21:33:04 deraadt Exp $ */ /* $NetBSD: usbdevs.c,v 1.19 2002/02/21 00:34:31 christos Exp $ */ /* @@ -267,13 +267,16 @@ main(int argc, char **argv) int ch, i, f; char buf[50]; char *dev = 0; + const char *errstr; int addr = 0; int ncont; while ((ch = getopt(argc, argv, "a:df:v?")) != -1) { switch (ch) { case 'a': - addr = atoi(optarg); + addr = strtonum(optarg, 1, USB_MAX_DEVICES, &errstr); + if (errstr) + errx(1, "addr %s", errstr); break; case 'd': showdevs++; |