diff --git a/nse_nsock.cc b/nse_nsock.cc index 79c34ff9f..567eb7961 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -735,9 +735,9 @@ static int l_get_info (lua_State *L) lua_pushboolean(L, true); lua_pushstring(L, inet_ntop_both(af, &local, ipstring_local)); - lua_pushnumber(L, inet_port_both(af, &local)); + lua_pushinteger(L, inet_port_both(af, &local)); lua_pushstring(L, inet_ntop_both(af, &remote, ipstring_remote)); - lua_pushnumber(L, inet_port_both(af, &remote)); + lua_pushinteger(L, inet_port_both(af, &remote)); return 5; } diff --git a/nse_utility.cc b/nse_utility.cc index 72e53c9b9..b96c30cff 100644 --- a/nse_utility.cc +++ b/nse_utility.cc @@ -157,8 +157,8 @@ uint16_t nseU_checkport (lua_State *L, int idx, const char **protocol) if (lua_istable(L, idx)) { lua_getfield(L, idx, "number"); - if (!lua_isnumber(L, -1)) - luaL_argerror(L, idx, "port table lacks numeric 'number' field"); + if (!lua_isinteger(L, -1)) + luaL_argerror(L, idx, "port table lacks integer 'number' field"); port = (uint16_t) lua_tointeger(L, -1); lua_getfield(L, idx, "protocol"); if (lua_isstring(L, -1)) @@ -205,8 +205,8 @@ Port *nseU_getport (lua_State *L, Target *target, Port *port, int idx) idx = lua_absindex(L, idx); luaL_checktype(L, idx, LUA_TTABLE); lua_getfield(L, idx, "number"); - if (!lua_isnumber(L, -1)) - luaL_error(L, "port 'number' field must be a number"); + if (!lua_isinteger(L, -1)) + luaL_error(L, "port 'number' field must be an integer"); lua_getfield(L, idx, "protocol"); if (!lua_isstring(L, -1)) luaL_error(L, "port 'protocol' field must be a string");