summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2014-03-10 19:57:25 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2014-03-10 19:57:25 +0000
commit93dfddad6383756fe8d22672f6c0af3e46c5b316 (patch)
tree1a79466866d1c5800da54cb354340ebc1fb8db72
parent69b949f2ed44bccb1db3847cb2b02ecc9a13876b (diff)
11_w_flag.msg
-rw-r--r--usr.sbin/traceroute6/traceroute6.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index 265051d3924..182edfb2cb3 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute6.c,v 1.59 2014/03/10 19:56:58 florian Exp $ */
+/* $OpenBSD: traceroute6.c,v 1.60 2014/03/10 19:57:24 florian Exp $ */
/* $KAME: traceroute6.c,v 1.63 2002/10/24 12:53:25 itojun Exp $ */
/*
@@ -494,19 +494,12 @@ main(int argc, char *argv[])
err(1, "setsockopt SO_RTABLE");
break;
case 'w':
- ep = NULL;
errno = 0;
- waittime = strtoul(optarg, &ep, 0);
- if (errno || !*optarg || *ep) {
- fprintf(stderr,
- "traceroute6: invalid wait time.\n");
- exit(1);
- }
- if (waittime <= 1) {
- fprintf(stderr,
- "traceroute6: wait must be >1 sec.\n");
- exit(1);
- }
+ ep = NULL;
+ l = strtol(optarg, &ep, 10);
+ if (errno || !*optarg || *ep || l <= 1 || l > INT_MAX)
+ errx(1, "wait must be >1 sec.");
+ waittime = (int)l;
break;
default:
usage();