From 47030f71db5998d804d5dd921740dcef8df847c7 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 1 Feb 2011 21:20:29 +0000 Subject: [PATCH] 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] --- CHANGELOG | 4 ++++ nse_nsock.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 2a9ec3514..ad6afe467 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/nse_nsock.cc b/nse_nsock.cc index aac0f8d65..491d8915a 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -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); }