projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a663c93
)
reject invalid address families in getaddrinfo
author
Rich Felker
<dalias@aerifal.cx>
Wed, 27 Nov 2013 05:54:03 +0000
(
00:54
-0500)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 27 Nov 2013 05:54:03 +0000
(
00:54
-0500)
subsequent code assumes the address family requested is either
unspecified or one of IPv4/IPv6, and could malfunction if this
constraint is not met, so other address families should be explicitly
rejected.
src/network/getaddrinfo.c
patch
|
blob
|
history
diff --git
a/src/network/getaddrinfo.c
b/src/network/getaddrinfo.c
index
e58db6c
..
5d45be7
100644
(file)
--- a/
src/network/getaddrinfo.c
+++ b/
src/network/getaddrinfo.c
@@
-62,6
+62,9
@@
int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
int result;
int cnt;
+ if (family != AF_INET && family != AF_INET6 && family != AF_UNSPEC)
+ return EAI_FAMILY;
+
if (host && strlen(host)>255) return EAI_NONAME;
if (serv && strlen(serv)>32) return EAI_SERVICE;