1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-01 02:59:01 +00:00

Fix an error check in check_target.

There was a missing level of deference on the pointers, so a condition
was never true in normal use. The effect was that check_target could
return without haveing put something in *addr, the previous contents of
which would later be passed to getaddrinfo, causing a "Name or service
not known" error.
This commit is contained in:
david
2012-04-04 04:54:17 +00:00
parent 1286e5bdd7
commit b023f71618

View File

@@ -90,7 +90,7 @@ void check_target (lua_State *L, int idx, const char **address, const char **tar
*address = lua_tostring(L, -1);
lua_getfield(L, idx, "targetname");
*targetname = lua_tostring(L, -1);
if (address == NULL && targetname == NULL)
if (*address == NULL && *targetname == NULL)
luaL_argerror(L, idx, "host table lacks 'ip' or 'targetname' fields");
*address = *address ? *address : *targetname;
lua_pop(L, 2); /* no point replacing idx, need 2 only have 1 */