diff options
author | peter <peter@FreeBSD.org> | 1999-11-30 02:43:11 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-11-30 02:43:11 +0000 |
commit | 9716636318d4160418baceabe7ba05ce065692fc (patch) | |
tree | 486664278b935f789477f5f876359d7b1f743529 /contrib/bind/lib/inet/inet_network.c | |
parent | dc618593bdb400692edd72ab5a4296a7e33ed5e2 (diff) | |
parent | 4ef23ce6957fc75fc005885496d605fed48213e1 (diff) | |
download | FreeBSD-src-9716636318d4160418baceabe7ba05ce065692fc.zip FreeBSD-src-9716636318d4160418baceabe7ba05ce065692fc.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r53910,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/bind/lib/inet/inet_network.c')
-rw-r--r-- | contrib/bind/lib/inet/inet_network.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/bind/lib/inet/inet_network.c b/contrib/bind/lib/inet/inet_network.c index 485b0b9..d26369c 100644 --- a/contrib/bind/lib/inet/inet_network.c +++ b/contrib/bind/lib/inet/inet_network.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; +static const char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ #include "port_before.h" @@ -56,28 +56,35 @@ inet_network(cp) register u_long val, base, n, i; register char c; u_long parts[4], *pp = parts; + int digit; again: - val = 0; base = 10; + val = 0; base = 10; digit = 0; if (*cp == '0') - base = 8, cp++; + digit = 1, base = 8, cp++; if (*cp == 'x' || *cp == 'X') base = 16, cp++; while ((c = *cp) != 0) { if (isdigit(c)) { + if (base == 8 && (c == '8' || c == '9')) + return (INADDR_NONE); val = (val * base) + (c - '0'); cp++; + digit = 1; continue; } if (base == 16 && isxdigit(c)) { val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); cp++; + digit = 1; continue; } break; } + if (!digit) + return (INADDR_NONE); if (*cp == '.') { - if (pp >= parts + 4) + if (pp >= parts + 4 || val > 0xff) return (INADDR_NONE); *pp++ = val, cp++; goto again; |