projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ec41199
)
remove an unnecessary check in inet_pton
author
Szabolcs Nagy
<nsz@port70.net>
Thu, 12 Dec 2013 04:18:34 +0000
(
04:18
+0000)
committer
Szabolcs Nagy
<nsz@port70.net>
Thu, 12 Dec 2013 04:18:34 +0000
(
04:18
+0000)
at most 4 hexadecimal digits are processed in one field so the
value cannot overflow. the netdb.h header was not used.
src/network/inet_pton.c
patch
|
blob
|
history
diff --git
a/src/network/inet_pton.c
b/src/network/inet_pton.c
index f840dd448d8b52a9e7072feaf1099203eeec9bd6..4496b47b6d6ccaa20ae3dd0ec8a363f54694375d 100644
(file)
--- 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;