diff options
author | Szabolcs Nagy <nsz@port70.net> | 2013-12-12 04:18:34 +0000 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2013-12-12 04:18:34 +0000 |
commit | ac45692a53a1b8d2ede329d91652d43c1fb5dc8d (patch) | |
tree | 2188d6ad97cd35ed316885e4691416912c0543f1 | |
parent | ec411999a0262c8e3e6be53ae11ad761776a2fc1 (diff) | |
download | musl-ac45692a53a1b8d2ede329d91652d43c1fb5dc8d.tar.gz musl-ac45692a53a1b8d2ede329d91652d43c1fb5dc8d.tar.xz musl-ac45692a53a1b8d2ede329d91652d43c1fb5dc8d.zip |
remove an unnecessary check in inet_pton
at most 4 hexadecimal digits are processed in one field so the value cannot overflow. the netdb.h header was not used.
-rw-r--r-- | src/network/inet_pton.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/network/inet_pton.c b/src/network/inet_pton.c index f840dd44..4496b47b 100644 --- a/src/network/inet_pton.c +++ b/src/network/inet_pton.c @@ -1,5 +1,4 @@ #include <sys/socket.h> -#include <netdb.h> #include <arpa/inet.h> #include <ctype.h> #include <errno.h> @@ -46,7 +45,7 @@ int inet_pton(int af, const char *restrict s, void *restrict a0) } for (v=j=0; j<4 && (d=hexval(s[j]))>=0; j++) v=16*v+d; - if (j==0 || v > 65535) return 0; + if (j==0) return 0; ip[i] = v; if (!s[j] && (brk>=0 || i==7)) break; if (i==7) return 0; |