1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Avoid passing empty string to nsock_pool_set_device

Nsock checks for NULL, but not for empty string. Rather than making
Nsock decide, each app will decide whether to call
nsock_pool_set_device, with all currently skipping the call if device is
an empty string.
This commit is contained in:
dmiller
2025-06-09 18:38:59 +00:00
parent 2216e3856e
commit 4ed1ce0eee
5 changed files with 11 additions and 5 deletions

View File

@@ -139,6 +139,7 @@ void FPNetworkControl::init(const char *ifname, devtype iftype) {
nmap_set_nsock_logger();
nmap_adjust_loglevel(o.packetTrace());
if (*o.device)
nsock_pool_set_device(nsp, o.device);
if (o.proxy_chain)

View File

@@ -1381,6 +1381,7 @@ static void nmap_mass_dns_core(DNS::Request *requests, int num_requests) {
nmap_set_nsock_logger();
nmap_adjust_loglevel(o.packetTrace());
if (*o.device)
nsock_pool_set_device(dnspool, o.device);
if (o.proxy_chain)

View File

@@ -97,7 +97,9 @@ int ProbeMode::init_nsock(){
/* Create a new nsock pool */
if ((nsp = nsock_pool_new(NULL)) == NULL)
nping_fatal(QT_3, "Failed to create new pool. QUITTING.\n");
nsock_pool_set_device(nsp, o.getDevice());
const char *device = o.getDevice();
if (*device)
nsock_pool_set_device(nsp, device);
/* Allow broadcast addresses */
nsock_pool_set_broadcast(nsp, 1);

View File

@@ -86,6 +86,7 @@ static nsock_pool new_pool (lua_State *L)
nmap_set_nsock_logger();
nmap_adjust_loglevel(o.scriptTrace());
if (*o.device)
nsock_pool_set_device(nsp, o.device);
if (o.proxy_chain)

View File

@@ -2817,6 +2817,7 @@ int service_scan(std::vector<Target *> &Targets) {
nmap_set_nsock_logger();
nmap_adjust_loglevel(o.versionTrace());
if (*o.device)
nsock_pool_set_device(nsp, o.device);
if (o.proxy_chain) {