From bbc423734e2ea8d2098235f13211c5be495cbf01 Mon Sep 17 00:00:00 2001 From: patrik Date: Thu, 7 Jun 2012 18:08:18 +0000 Subject: [PATCH] Fixed bug that would make the script crash with the following error if the latitude and longitude for an IP could not be determined: attempt to concatenate field 'longitude' (a table value) --- scripts/ip-geolocation-geobytes.nse | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ip-geolocation-geobytes.nse b/scripts/ip-geolocation-geobytes.nse index 995220740..4294ac3b0 100644 --- a/scripts/ip-geolocation-geobytes.nse +++ b/scripts/ip-geolocation-geobytes.nse @@ -57,6 +57,10 @@ local geobytes = function(ip) return nil end -- Process output + -- an empty table is returned when latitude and longitude can not be determined + if ( "table" == type(loc.latitude) or "table" == type(loc.longitude) ) then + return { "Could not determine location for IP" } + end table.insert(output, "coordinates (lat,lon): " .. loc.latitude .. "," .. loc.longitude) table.insert(output,"city: ".. loc.city..", ".. loc.region..", ".. loc.country) return output