summaryrefslogtreecommitdiff
path: root/usr.sbin/trpt/trpt.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-18 05:15:40 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-11-18 05:15:40 +0000
commitbe19a9637559ef1f7be6764d2fda1d1aad6598b4 (patch)
tree509b9f6e43ac6e67c1506156b15651b5c09112e0 /usr.sbin/trpt/trpt.c
parent049cb8eb58b0f21d367d2f843188c149b4abc81c (diff)
strto* usage audit. deraadt ok
Diffstat (limited to 'usr.sbin/trpt/trpt.c')
-rw-r--r--usr.sbin/trpt/trpt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/trpt/trpt.c b/usr.sbin/trpt/trpt.c
index 833aec7cc45..0086a7507ca 100644
--- a/usr.sbin/trpt/trpt.c
+++ b/usr.sbin/trpt/trpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trpt.c,v 1.13 2002/06/19 08:45:52 deraadt Exp $ */
+/* $OpenBSD: trpt.c,v 1.14 2002/11/18 05:15:39 itojun Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -149,6 +149,7 @@ main(argc, argv)
{
int ch, i, jflag, npcbs;
char *system, *core, *cp, errbuf[_POSIX2_LINE_MAX];
+ unsigned long l;
system = core = NULL;
@@ -169,9 +170,12 @@ main(argc, argv)
if (npcbs >= TCP_NDEBUG)
errx(1, "too many pcbs specified");
errno = 0;
- tcp_pcbs[npcbs++] = (caddr_t)strtoul(optarg, &cp, 16);
- if (*cp != '\0' || errno == ERANGE)
+ l = strtoul(optarg, &cp, 16);
+ tcp_pcbs[npcbs] = (caddr_t)l;
+ if (*optarg == '\0' || *cp != '\0' || errno ||
+ (unsigned long)tcp_pcbs[npcbs] != l)
errx(1, "invalid address: %s", optarg);
+ npcbs++;
break;
case 's':
++sflag;