Make prefixlen check to make sure its argument is present before deref

from openbsd
This commit is contained in:
itojun 2002-10-18 00:16:25 +00:00
parent 68603e5242
commit 3c30f46849

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.59 2002/07/20 08:36:27 grant Exp $ */ /* $NetBSD: route.c,v 1.60 2002/10/18 00:16:25 itojun Exp $ */
/* /*
* Copyright (c) 1983, 1989, 1991, 1993 * Copyright (c) 1983, 1989, 1991, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: route.c,v 1.59 2002/07/20 08:36:27 grant Exp $"); __RCSID("$NetBSD: route.c,v 1.60 2002/10/18 00:16:25 itojun Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -934,7 +934,8 @@ newroute(argc, argv)
forcenet++; forcenet++;
break; break;
case K_PREFIXLEN: case K_PREFIXLEN:
argc--; if (!--argc)
usage(1+*argv);
if (prefixlen(*++argv) == 128) { if (prefixlen(*++argv) == 128) {
forcenet = 0; forcenet = 0;
ishost = 1; ishost = 1;