1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-20 13:19:01 +00:00

Handle the case of half-byte hex string in ipOps.hex_to_bin

This commit is contained in:
dmiller
2014-12-03 04:15:09 +00:00
parent 08709b41dc
commit b1c8c3f224

View File

@@ -9,7 +9,6 @@ local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
local type = type
local select = select
local ipairs = ipairs
local tonumber = tonumber
local unittest = require "unittest"
@@ -648,7 +647,8 @@ hex_to_bin = function( hex )
end
local d = bin.pack("H", hex)
return select(2, bin.unpack("B" .. #d, d))
local _, b = bin.unpack("B" .. #d, d)
return b:sub(1, #hex * 4)
end
--Ignore the rest if we are not testing.