From 88c7e9d1e8910205aac54404fac1c63afd14e769 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 16 Dec 2021 23:29:17 +0000 Subject: [PATCH] Use less space for pcap dev name; simplify ifdef --- nse_nsock.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nse_nsock.cc b/nse_nsock.cc index 8082a42f1..fb17c3a8d 100644 --- a/nse_nsock.cc +++ b/nse_nsock.cc @@ -976,19 +976,19 @@ static void dnet_to_pcap_device_name (lua_State *L, const char *device) if (strcmp(device, "any") == 0) lua_pushliteral(L, "any"); else -#ifdef WIN32 { - char pcapdev[4096]; +#ifdef WIN32 + // Packet32.h: #define ADAPTER_NAME_LENGTH 256 + 12 + // We'll use a little extra to be safe. + char pcapdev[384]; /* Nmap normally uses device names obtained through dnet for interfaces, but Pcap has its own naming system. So the conversion is done here */ - if (!DnetName2PcapName(device, pcapdev, sizeof(pcapdev))) - lua_pushstring(L, device); - else + if (DnetName2PcapName(device, pcapdev, sizeof(pcapdev))) lua_pushstring(L, pcapdev); - } -#else - lua_pushstring(L, device); + else #endif + lua_pushstring(L, device); + } } static int pcap_gc (lua_State *L)