o [NSE] Made it a controlled Lua stack trace instead of a fatal error

when an NSE script sets a negative socket timeout. Vlatko Kosturjak
  reported the bug. [David]
This commit is contained in:
david 2011-02-01 21:20:29 +00:00
parent 06b988353a
commit 47030f71db
2 changed files with 6 additions and 0 deletions

View file

@ -1,5 +1,9 @@
# Nmap Changelog ($Id$); -*-text-*-
o [NSE] Made it a controlled Lua stack trace instead of a fatal error
when an NSE script sets a negative socket timeout. Vlatko Kosturjak
reported the bug. [David]
o [NSE] Fixed a bug which caused some NSE scripts to fail, due to the
absence of the NSE SCRIPT_NAME environment variable when the scripts
are loaded. Michael Pattrick reported the problem. [Djalal]

View file

@ -756,6 +756,8 @@ static int l_set_timeout (lua_State *L)
{
nse_nsock_udata *nu = check_nsock_udata(L, 1, 0);
nu->timeout = luaL_checkint(L, 2);
if ((int) nu->timeout < -1)
return luaL_error(L, "Negative timeout: %d", nu->timeout);
return success(L);
}