Fix to allow cpe port table entry to be nil when calling set_port_version

This commit is contained in:
patrik 2012-03-27 21:55:32 +00:00
parent 9a67069869
commit 9b9aceac92

View file

@ -594,13 +594,15 @@ static int l_set_port_version (lua_State *L)
luaL_argerror(L, 2, "invalid value for port.version.service_tunnel");
lua_getfield(L, 4, "cpe");
if (!lua_istable(L, -1))
if (lua_isnil(L, -1))
;
else if(lua_istable(L, -1))
for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
cpe.push_back(lua_tostring(L, -1));
}
else
luaL_error(L, "port.version 'cpe' field must be a table");
for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
cpe.push_back(lua_tostring(L, -1));
}
if (o.servicescan)
target->ports.setServiceProbeResults(p->portno, p->proto,
probestate, name, tunnel, product,