1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-17 21:19:01 +00:00

Fix bugs where pos return value of bin.unpack was ignored

This commit is contained in:
dmiller
2016-07-21 17:05:24 +00:00
parent be3cd99dbc
commit 963011520f
4 changed files with 5 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ ASN1Decoder = {
-- Boolean -- Boolean
self.decoder["01"] = function( self, encStr, elen, pos ) self.decoder["01"] = function( self, encStr, elen, pos )
local val = bin.unpack("H", encStr, pos) local pos, val = bin.unpack("H", encStr, pos)
if val ~= "FF" then if val ~= "FF" then
return pos, true return pos, true
else else

View File

@@ -676,7 +676,7 @@ end
-- local res -- local res
-- res = versionQuery() -- res = versionQuery()
-- print(type(res),res:len(),res) -- print(type(res),res:len(),res)
-- local out= bin.unpack('C'..#res,res) -- local _, out= bin.unpack('C'..#res,res)
-- printBuffer(res) -- printBuffer(res)
-- end -- end
--test() --test()

View File

@@ -932,7 +932,8 @@ function get_host_info_from_security_blob(security_blob)
break break
elseif ( av_id == NTLM_AV_ID_VALUES.MsvAvTimestamp ) then elseif ( av_id == NTLM_AV_ID_VALUES.MsvAvTimestamp ) then
-- this is a FILETIME value (see [MS-DTYP]), representing the time in 100-ns increments since 1/1/1601 -- this is a FILETIME value (see [MS-DTYP]), representing the time in 100-ns increments since 1/1/1601
ntlm_challenge[ friendly_name ] = bin.unpack( "<L", value ) local _
_, ntlm_challenge[ friendly_name ] = bin.unpack( "<L", value )
elseif ( friendly_name ) then elseif ( friendly_name ) then
ntlm_challenge[ friendly_name ] = unicode.utf16to8( value ) ntlm_challenge[ friendly_name ] = unicode.utf16to8( value )
end end

View File

@@ -466,7 +466,7 @@ StartTLS = {
while optype ~= mssql.PreLoginPacket.OPTION_TYPE.Terminator do while optype ~= mssql.PreLoginPacket.OPTION_TYPE.Terminator do
--stdnse.debug1("optype: %d, oppos: %x, oplen: %d", optype, oppos, oplen) --stdnse.debug1("optype: %d, oppos: %x, oplen: %d", optype, oppos, oplen)
if optype == mssql.PreLoginPacket.OPTION_TYPE.Encryption then if optype == mssql.PreLoginPacket.OPTION_TYPE.Encryption then
encryption = bin.unpack('C', result, oppos + 1) pos, encryption = bin.unpack('C', result, oppos + 1)
break break
end end
pos, optype, oppos, oplen = bin.unpack('>CSS', result, pos) pos, optype, oppos, oplen = bin.unpack('>CSS', result, pos)