mirror of
https://github.com/nmap/nmap.git
synced 2026-11-20 08:40:36 +08:00
Fix DRDA Parameter parsing in error case
This commit is contained in:
+5
-2
@@ -268,13 +268,16 @@ DRDA = {
|
||||
|
||||
status, data = db2socket:receive_buf( match.numbytes(ddm.Length - 10), true )
|
||||
if ( not(status) ) then
|
||||
return false, ("Failed to read the remaining %d bytes of the DRDA message")
|
||||
return false, ("Failed to read the remaining %d bytes of the DRDA message"):format(ddm.Length - 10)
|
||||
end
|
||||
|
||||
-- add parameters until pos reaches the "end"
|
||||
repeat
|
||||
local param = DRDAParameter:new()
|
||||
pos = param:fromString( data, pos )
|
||||
if pos < 1 then
|
||||
return false, "Bad DRDA Parameter"
|
||||
end
|
||||
self:addParameter( param )
|
||||
until ( #data <= pos )
|
||||
|
||||
@@ -320,7 +323,7 @@ DRDAParameter = {
|
||||
end
|
||||
self.Length, self.CodePoint, pos = string.unpack( ">I2I2", data, pos )
|
||||
|
||||
if ( self.Length > 0 ) then
|
||||
if ( self.Length > 4 ) then
|
||||
self.Data, pos = string.unpack("c" .. self.Length - 4, data, pos )
|
||||
end
|
||||
return pos
|
||||
|
||||
Reference in New Issue
Block a user