From b1c8c3f224976f2b5a7b604f4f8cbfe1e8080d72 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 3 Dec 2014 04:15:09 +0000 Subject: [PATCH] Handle the case of half-byte hex string in ipOps.hex_to_bin --- nselib/ipOps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nselib/ipOps.lua b/nselib/ipOps.lua index eb0e6b0c2..9740ffd2c 100644 --- a/nselib/ipOps.lua +++ b/nselib/ipOps.lua @@ -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.