From 91e1d21cc1ff212cd4f7827e3fdbb3b0c14d1d8e Mon Sep 17 00:00:00 2001 From: patrik Date: Thu, 17 Apr 2014 01:00:01 +0000 Subject: [PATCH] add nil checks to address bug discovered by Mike http://seclists.org/nmap-dev/2014/q2/120 --- scripts/snmp-ios-config.nse | 3 +++ scripts/snmp-sysdescr.nse | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/snmp-ios-config.nse b/scripts/snmp-ios-config.nse index 5708ab32b..bb242bdd0 100644 --- a/scripts/snmp-ios-config.nse +++ b/scripts/snmp-ios-config.nse @@ -179,6 +179,9 @@ action = function(host, port) local result result = snmp.fetchFirst(response) + if not result then + return + end if result == 3 then result = ( infile and infile:getContent() ) diff --git a/scripts/snmp-sysdescr.nse b/scripts/snmp-sysdescr.nse index 4616bc5d8..0122f16e7 100644 --- a/scripts/snmp-sysdescr.nse +++ b/scripts/snmp-sysdescr.nse @@ -93,6 +93,9 @@ action = function(host, port) try(socket:close()) local uptime = snmp.fetchFirst(response) + if not uptime then + return + end local days, hours, minutes, seconds, htime, mtime, stime days = math.floor(uptime / 8640000)