1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-15 02:49:02 +00:00

Informix messages are aligned to 2 bytes. Possible fix for #1122

This commit is contained in:
dmiller
2018-03-10 03:09:31 +00:00
parent 262d425843
commit ebf7528c5b

View File

@@ -350,7 +350,7 @@ MessageDecoders = {
_, len = bin.unpack(">S", data )
-- read the remaining data
return socket:receive_buf(match.numbytes(len + 2), true)
return socket:receive_buf(match.numbytes(len + 2 + len % 2), true)
end,
--- Decodes the SQ_EOT message
@@ -445,7 +445,7 @@ MessageDecoders = {
table.insert( column_meta, col_md )
end
status, data = socket:receive_buf(match.numbytes(( coldesc_len % 2 ) == 0 and coldesc_len or coldesc_len + 1), true)
status, data = socket:receive_buf(match.numbytes(coldesc_len + coldesc_len % 2), true)
if( not(status) ) then return false, "Failed to decode SQ_DESCRIBE response" end
pos = 1
@@ -492,7 +492,7 @@ MessageDecoders = {
if( not(status) ) then return false, "Failed to read column data" end
local _, total_len = bin.unpack(">I", data, 3)
status, data = socket:receive_buf(match.numbytes(( total_len % 2 == 0 ) and total_len or total_len + 1), true)
status, data = socket:receive_buf(match.numbytes(total_len + total_len % 2), true)
if( not(status) ) then return false, "Failed to read column data" end
row = {}
@@ -562,16 +562,11 @@ MessageDecoders = {
pos, len = bin.unpack(">S", data)
if ( 0 == len ) then break end
status, data = socket:receive_buf(match.numbytes(len), true)
status, data = socket:receive_buf(match.numbytes(len + len % 2), true)
if ( not(status) ) then return false, "Failed to parse SQ_DBLIST response" end
pos, db = bin.unpack("A" .. len, data )
table.insert( databases, db )
if ( len %2 == 1 ) then
socket:receive_buf(match.numbytes(1), true)
if ( not(status) ) then return false, "Failed to parse SQ_DBLIST response" end
end
end
-- read SQ_EOT