summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-15 19:06:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-15 19:06:10 +0000
commit2e2bdb1e57fe3d800767b230ed3641a7a64680c5 (patch)
treef1209fe7b0f969ee32b253faff4f552e9270e254 /sbin
parent2ea94bcf0919960a6c48ce3925e80c03fc6aec90 (diff)
stop walking off argv[]; netbsd pr#2700, mason@primenet.com.au fixed by me
Diffstat (limited to 'sbin')
-rw-r--r--sbin/route/route.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sbin/route/route.c b/sbin/route/route.c
index cfd92dc8afd..359f52f5db3 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.6 1996/08/05 11:53:41 deraadt Exp $ */
+/* $OpenBSD: route.c,v 1.7 1996/08/15 19:06:09 deraadt Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#else
-static char rcsid[] = "$OpenBSD: route.c,v 1.6 1996/08/05 11:53:41 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: route.c,v 1.7 1996/08/15 19:06:09 deraadt Exp $";
#endif
#endif /* not lint */
@@ -584,28 +584,34 @@ newroute(argc, argv)
flags |= RTF_STATIC;
break;
case K_IFA:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
(void) getaddr(RTA_IFA, *++argv, 0);
break;
case K_IFP:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
(void) getaddr(RTA_IFP, *++argv, 0);
break;
case K_GENMASK:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
(void) getaddr(RTA_GENMASK, *++argv, 0);
break;
case K_GATEWAY:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
(void) getaddr(RTA_GATEWAY, *++argv, 0);
break;
case K_DST:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
ishost = getaddr(RTA_DST, *++argv, &hp);
dest = *argv;
break;
case K_NETMASK:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
(void) getaddr(RTA_NETMASK, *++argv, 0);
/* FALLTHROUGH */
case K_NET:
@@ -619,7 +625,8 @@ newroute(argc, argv)
case K_SSTHRESH:
case K_RTT:
case K_RTTVAR:
- argc--;
+ if (!--argc)
+ usage(1+*argv);
set_metric(*++argv, key);
break;
default: