mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 06:31:30 +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:
@@ -1,5 +1,9 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# 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
|
o [Zenmap] Worked around a pycairo bug that prevented saving the
|
||||||
topology graphic as PNG on Windows: "Error Saving Snapshot:
|
topology graphic as PNG on Windows: "Error Saving Snapshot:
|
||||||
Surface.write_to_png takes one argument which must be a filename
|
Surface.write_to_png takes one argument which must be a filename
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
|
|||||||
resolvedaddrs.push_back(ss);
|
resolvedaddrs.push_back(ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (addrs != NULL)
|
||||||
freeaddrinfo(addrs);
|
freeaddrinfo(addrs);
|
||||||
|
|
||||||
if (resolvedaddrs.empty()) {
|
if (resolvedaddrs.empty()) {
|
||||||
@@ -330,6 +331,7 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
|
|||||||
resolvedaddrs.push_back(ss);
|
resolvedaddrs.push_back(ss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (addrs != NULL)
|
||||||
freeaddrinfo(addrs);
|
freeaddrinfo(addrs);
|
||||||
|
|
||||||
if (resolvedaddrs.empty()) {
|
if (resolvedaddrs.empty()) {
|
||||||
|
|||||||
@@ -724,6 +724,7 @@ static int l_resolve(lua_State *L)
|
|||||||
lua_rawseti(L, -2, i++);
|
lua_rawseti(L, -2, i++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addrs != NULL)
|
||||||
freeaddrinfo(addrs);
|
freeaddrinfo(addrs);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
|
|||||||
@@ -576,6 +576,7 @@ static int l_connect (lua_State *L)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dest != NULL)
|
||||||
freeaddrinfo(dest);
|
freeaddrinfo(dest);
|
||||||
return yield(L, nu, "CONNECT", TO, 0, NULL);
|
return yield(L, nu, "CONNECT", TO, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
2
tcpip.cc
2
tcpip.cc
@@ -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.
|
/* Tries to resolve the given name (or literal IP) into a sockaddr structure.
|
||||||
This function calls getaddrinfo and returns the same addrinfo linked list
|
This function calls getaddrinfo and returns the same addrinfo linked list
|
||||||
that getaddrinfo produces. Returns NULL for any error or failure to resolve.
|
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 *resolve_all(char *hostname, int pf)
|
||||||
{
|
{
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
|
|||||||
Reference in New Issue
Block a user