Get rid of segfaults in a set-uid program.

PR:		11823
Reviewed by:	des
This commit is contained in:
Ruslan Ermilov 1999-06-01 13:14:07 +00:00
parent f0828bf1b0
commit 1e3b39d361
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47668

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94";
#endif
static const char rcsid[] =
"$Id$";
"$Id: route.c,v 1.29 1998/07/28 06:25:35 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -581,28 +581,34 @@ newroute(argc, argv)
flags |= RTF_STATIC;
break;
case K_IFA:
argc--;
if (!--argc)
usage((char *)NULL);
(void) getaddr(RTA_IFA, *++argv, 0);
break;
case K_IFP:
argc--;
if (!--argc)
usage((char *)NULL);
(void) getaddr(RTA_IFP, *++argv, 0);
break;
case K_GENMASK:
argc--;
if (!--argc)
usage((char *)NULL);
(void) getaddr(RTA_GENMASK, *++argv, 0);
break;
case K_GATEWAY:
argc--;
if (!--argc)
usage((char *)NULL);
(void) getaddr(RTA_GATEWAY, *++argv, 0);
break;
case K_DST:
argc--;
if (!--argc)
usage((char *)NULL);
ishost = getaddr(RTA_DST, *++argv, &hp);
dest = *argv;
break;
case K_NETMASK:
argc--;
if (!--argc)
usage((char *)NULL);
(void) getaddr(RTA_NETMASK, *++argv, 0);
/* FALLTHROUGH */
case K_NET:
@ -616,7 +622,8 @@ newroute(argc, argv)
case K_SSTHRESH:
case K_RTT:
case K_RTTVAR:
argc--;
if (!--argc)
usage((char *)NULL);
set_metric(*++argv, key);
break;
default: