Check that the argument to freeaddrinfo is not NULL. The behavior may be

unspecified and causes a segmentation fault on Android Bionic libc.
Vlatko fixed the bug in his Android binaries and it was first reported
by @alexismm2.
This commit is contained in:
david 2011-02-15 08:19:58 +00:00
parent f8b55e3253
commit bf99fb231b
5 changed files with 13 additions and 5 deletions

View file

@ -220,7 +220,8 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
resolvedaddrs.push_back(ss);
}
}
freeaddrinfo(addrs);
if (addrs != NULL)
freeaddrinfo(addrs);
if (resolvedaddrs.empty()) {
error("Failed to resolve given hostname/IP: %s. Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges", target_net);
@ -330,7 +331,8 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
resolvedaddrs.push_back(ss);
}
}
freeaddrinfo(addrs);
if (addrs != NULL)
freeaddrinfo(addrs);
if (resolvedaddrs.empty()) {
error("Failed to resolve given IPv6 hostname/IP: %s. Note that you can't use '/mask' or '[1-4,7,100-]' style ranges for IPv6.", hostexp);