mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Correct detection of end-of-options in the DHCP parser, which rectifies
false warning "Unexpected end of options" on valid packets.
This commit is contained in:
@@ -503,18 +503,19 @@ function dhcp_parse(data, transaction_id)
|
|||||||
-- Parse the options
|
-- Parse the options
|
||||||
result['options'] = {}
|
result['options'] = {}
|
||||||
while true do
|
while true do
|
||||||
if #data - pos < 2 then
|
local option, length = data:byte(pos, pos + 1)
|
||||||
|
|
||||||
|
-- Check for termination condition
|
||||||
|
if option == 0xFF then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (option and length) then
|
||||||
stdnse.debug1("Unexpected end of options")
|
stdnse.debug1("Unexpected end of options")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
local option, length
|
pos = pos + 2
|
||||||
option, length, pos = string.unpack(">BB", data, pos)
|
|
||||||
|
|
||||||
-- Check for termination condition
|
|
||||||
if(option == 0xFF) then
|
|
||||||
break;
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get the action from the array, based on the code
|
-- Get the action from the array, based on the code
|
||||||
local action = actions[option]
|
local action = actions[option]
|
||||||
|
|||||||
Reference in New Issue
Block a user