mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Use string_pool for service names so they aren't freed by Lua. See #2657
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
#include "services.h"
|
#include "services.h"
|
||||||
#include "protocols.h"
|
#include "protocols.h"
|
||||||
#include "tcpip.h"
|
#include "tcpip.h"
|
||||||
|
#include "string_pool.h"
|
||||||
#include "libnetutil/netutil.h"
|
#include "libnetutil/netutil.h"
|
||||||
|
|
||||||
#if HAVE_STRINGS_H
|
#if HAVE_STRINGS_H
|
||||||
@@ -347,7 +348,7 @@ void PortList::setServiceProbeResults(u16 portno, int protocol,
|
|||||||
port->service->service_tunnel = tunnel;
|
port->service->service_tunnel = tunnel;
|
||||||
|
|
||||||
if (sname)
|
if (sname)
|
||||||
port->service->name = sname;
|
port->service->name = string_pool_insert(sname);
|
||||||
else
|
else
|
||||||
port->service->name = NULL;
|
port->service->name = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
#include "services.h"
|
#include "services.h"
|
||||||
#include "protocols.h"
|
#include "protocols.h"
|
||||||
#include "NmapOps.h"
|
#include "NmapOps.h"
|
||||||
#include "charpool.h"
|
#include "string_pool.h"
|
||||||
#include "nmap_error.h"
|
#include "nmap_error.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ static int nmap_services_init() {
|
|||||||
sn.s_name = NULL;
|
sn.s_name = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sn.s_name = cp_strdup(servicename);
|
sn.s_name = string_pool_insert(servicename);
|
||||||
}
|
}
|
||||||
sn.s_port = portno;
|
sn.s_port = portno;
|
||||||
sn.s_proto = npe->p_name;
|
sn.s_proto = npe->p_name;
|
||||||
|
|||||||
Reference in New Issue
Block a user