From b023f71618642a89dfeb945eebf689b212a5f879 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 4 Apr 2012 04:54:17 +0000 Subject: [PATCH] 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. --- nse_utility.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nse_utility.cc b/nse_utility.cc index 45e48016a..540b48934 100644 --- a/nse_utility.cc +++ b/nse_utility.cc @@ -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 */