From 042376289d238c7dea05cb68cc2b868f21c822f3 Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 21 Aug 2026 01:29:35 +0000 Subject: [PATCH] Restore correct behavior of socket:get_info() and others Since Nmap 7.93, requesting certain operations on an unconnected NSE socket would result in a Lua error being thrown instead of the (nil, message) return that was expected. vnc-info and the http.lua library both use socket:get_info() as a check for whether the socket is connected. This restores the expected behavior. Fixes #3424 --- nse_nsock.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nse_nsock.cc b/nse_nsock.cc index 2162f221d..e91627bee 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -445,9 +445,9 @@ static nse_nsock_udata *check_nsock_udata (lua_State *L, int idx, bool open) #define NSOCK_UDATA_ENSURE_OPEN(L, nu) \ do { \ if (nu->nsiod == NULL) \ - return luaL_error(L, "socket must be connected"); \ + return nseU_safeerror(L, "socket must be connected"); \ if (nu->af == NSE_AF_PCAP) \ - return luaL_error(L, "invalid operation on pcap socket"); \ + return nseU_safeerror(L, "invalid operation on pcap socket"); \ } while (0) static int l_loop (lua_State *L)