Subject: lib/2089: route(8) coredumps when given more than 4 octets
To: None <gnats-bugs@NetBSD.ORG>
From: Amy Baron <amee@beer.org>
List: netbsd-bugs
Date: 02/16/1996 18:56:53
>Number:         2089
>Category:       lib
>Synopsis:       route(8) coredumps when given more than 4 octets
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 16 21:20:02 1996
>Last-Modified:
>Originator:     Amy Baron
>Organization:
none whatsoever
>Release:        NetBSD-current Feb 1
>Environment:
System: NetBSD lager.beer.org 1.1A NetBSD 1.1A (LAGER) #2: Thu Jan 4 17:24:51 MST 1996 hpeyerl@lager.beer.org:/usr/src/sys/arch/hp300/compile/LAGER hp300


>Description:
	route(8) coredumps when given more than 4 octets. while one
	shouldn't give more than 4, it should return INADDR_NONE instead
	of coredumping. 

>How-To-Repeat:
	route add default 1.2.3.4.5
	route add 1.2.3.4 1.2.3..4	
>Fix:

*** inet_network.c.orig	Thu Feb 15 23:44:38 1996
--- inet_network.c	Thu Feb 15 23:45:32 1996
***************
*** 80,86 ****
  		break;
  	}
  	if (*cp == '.') {
! 		if (pp >= parts + 4)
  			return (INADDR_NONE);
  		*pp++ = val, cp++;
  		goto again;
--- 80,86 ----
  		break;
  	}
  	if (*cp == '.') {
! 		if (pp >= parts + 3)
  			return (INADDR_NONE);
  		*pp++ = val, cp++;
  		goto again;
***************
*** 89,96 ****
  		return (INADDR_NONE);
  	*pp++ = val;
  	n = pp - parts;
- 	if (n > 4)
- 		return (INADDR_NONE);
  	for (val = 0, i = 0; i < n; i++) {
  		val <<= 8;
  		val |= parts[i] & 0xff;
--- 89,94 ----
>Audit-Trail:
>Unformatted: