Fix inet_network to not dump core if passed in an address

with more than 4 octets (e.g. 1.2.3.4.5).

Submitted by:	Amy Baron <amee@beer.org> via NetBSD-bugs
This commit is contained in:
Mike Pritchard 1996-02-17 21:11:36 +00:00
parent b227eb61e3
commit 48194b7e82

View File

@ -74,7 +74,7 @@ again:
break;
}
if (*cp == '.') {
if (pp >= parts + 4)
if (pp >= parts + 3)
return (INADDR_NONE);
*pp++ = val, cp++;
goto again;
@ -83,8 +83,6 @@ again:
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;