1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-10 09:49:05 +00:00

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

@@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o Added checks that the argument to freeaddrinfo is not NULL, avoiding
a segmentation fault on Android and possibly other platforms.
Suggested by Vlatko Kosturjak and Alexismm2.
o [Zenmap] Worked around a pycairo bug that prevented saving the
topology graphic as PNG on Windows: "Error Saving Snapshot:
Surface.write_to_png takes one argument which must be a filename

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);

View File

@@ -724,7 +724,8 @@ static int l_resolve(lua_State *L)
lua_rawseti(L, -2, i++);
}
freeaddrinfo(addrs);
if (addrs != NULL)
freeaddrinfo(addrs);
return 2;
}

View File

@@ -576,7 +576,8 @@ static int l_connect (lua_State *L)
break;
}
freeaddrinfo(dest);
if (dest != NULL)
freeaddrinfo(dest);
return yield(L, nu, "CONNECT", TO, 0, NULL);
}

View File

@@ -357,7 +357,7 @@ const char *inet_socktop(struct sockaddr_storage *ss) {
/* Tries to resolve the given name (or literal IP) into a sockaddr structure.
This function calls getaddrinfo and returns the same addrinfo linked list
that getaddrinfo produces. Returns NULL for any error or failure to resolve.
You need to call freeaddrinfo on the result. */
You need to call freeaddrinfo on the result if non-NULL. */
struct addrinfo *resolve_all(char *hostname, int pf)
{
struct addrinfo hints;