From 4a38853631c175051eb42b2943c038ffa21f067e Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 18 Feb 2020 17:37:57 +0000 Subject: [PATCH] Don't let UDP decoding bugs kill broadcast-listener main thread --- scripts/broadcast-listener.nse | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/broadcast-listener.nse b/scripts/broadcast-listener.nse index 34a4b46e5..813f94cde 100644 --- a/scripts/broadcast-listener.nse +++ b/scripts/broadcast-listener.nse @@ -153,10 +153,12 @@ sniffInterface = function(iface, Decoders, decodertab) -- if we have an UDP-based broadcast, we should have a proper packet if ( p and p.udp_dport and ( decodertab.udp[p.udp_dport] or Decoders.udp[p.udp_dport] ) ) then - if ( not(decodertab.udp[p.udp_dport]) ) then - decodertab.udp[p.udp_dport] = Decoders.udp[p.udp_dport]:new() + local uport = p.udp_dport + if ( not(decodertab.udp[uport]) ) then + decodertab.udp[uport] = Decoders.udp[uport]:new() end - decodertab.udp[p.udp_dport]:process(data) + stdnse.new_thread(decodertab.udp[uport].process, decodertab.udp[uport], data) + decoded = true -- The packet was decoded successfully but we don't have a valid decoder -- Report this elseif ( p and p.udp_dport ) then