Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 May 1999 22:19:44 +0300 (EEST)
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/11823: [PATCH] /sbin/route cleanup
Message-ID:  <199905211919.WAA80152@relay.ucb.crimea.ua>

next in thread | raw e-mail | index | archive | help

>Number:         11823
>Category:       bin
>Synopsis:       [PATCH] /sbin/route cleanup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 21 12:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Ruslan Ermilov
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
United Commercial Bank
>Environment:

3.2-STABLE
4.0-CURRENT

>Description:

/sbin/route doesn't check its syntax

>How-To-Repeat:

# route change default -gateway
Segmentation fault - core dumped

>Fix:
	
Index: route.c
===================================================================
RCS file: /usr/FreeBSD-CVS/src/sbin/route/route.c,v
retrieving revision 1.29
diff -u -r1.29 route.c
--- route.c	1998/07/28 06:25:35	1.29
+++ route.c	1999/05/21 19:12:05
@@ -582,28 +582,46 @@
 				break;
 			case K_IFA:
 				argc--;
-				(void) getaddr(RTA_IFA, *++argv, 0);
+				if (argc)
+					(void) getaddr(RTA_IFA, *++argv, 0);
+				else
+					usage((char *)NULL);
 				break;
 			case K_IFP:
 				argc--;
-				(void) getaddr(RTA_IFP, *++argv, 0);
+				if (argc)
+					(void) getaddr(RTA_IFP, *++argv, 0);
+				else
+					usage((char *)NULL);
 				break;
 			case K_GENMASK:
 				argc--;
-				(void) getaddr(RTA_GENMASK, *++argv, 0);
+				if (argc)
+					(void) getaddr(RTA_GENMASK, *++argv, 0);
+				else
+					usage((char *)NULL);
 				break;
 			case K_GATEWAY:
 				argc--;
-				(void) getaddr(RTA_GATEWAY, *++argv, 0);
+				if (argc)
+					(void) getaddr(RTA_GATEWAY, *++argv, 0);
+				else
+					usage((char *)NULL);
 				break;
 			case K_DST:
 				argc--;
-				ishost = getaddr(RTA_DST, *++argv, &hp);
-				dest = *argv;
+				if (argc) {
+					ishost = getaddr(RTA_DST, *++argv, &hp);
+					dest = *argv;
+				} else
+					usage((char *)NULL);
 				break;
 			case K_NETMASK:
 				argc--;
-				(void) getaddr(RTA_NETMASK, *++argv, 0);
+				if (argc)
+					(void) getaddr(RTA_NETMASK, *++argv, 0);
+				else
+					usage((char *)NULL);
 				/* FALLTHROUGH */
 			case K_NET:
 				forcenet++;
@@ -617,7 +635,10 @@
 			case K_RTT:
 			case K_RTTVAR:
 				argc--;
-				set_metric(*++argv, key);
+				if (argc)
+					set_metric(*++argv, key);
+				else
+					usage((char *)NULL);
 				break;
 			default:
 				usage(1+*argv);


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905211919.WAA80152>