mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Streamline the loop construct
This commit is contained in:
@@ -83,21 +83,17 @@ IPP = {
|
|||||||
attrib.value = {}
|
attrib.value = {}
|
||||||
table.insert(attrib.value, { tag = attrib.tag, val = val })
|
table.insert(attrib.value, { tag = attrib.tag, val = val })
|
||||||
|
|
||||||
repeat
|
while pos + 3 < #data do
|
||||||
local tag, name_len, val
|
local tag, name_len, val
|
||||||
|
tag, name_len, pos = string.unpack(">BI2", data, pos)
|
||||||
if ( #data < pos + 3 ) then
|
if name_len > 0 then
|
||||||
|
-- done; start of a new attribute
|
||||||
|
pos = pos - 3
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
val, pos = string.unpack(">s2", data, pos)
|
||||||
tag, name_len, pos = string.unpack(">BI2", data, pos)
|
table.insert(attrib.value, { tag = tag, val = val })
|
||||||
if ( name_len == 0 ) then
|
end
|
||||||
val, pos = string.unpack(">s2", data, pos)
|
|
||||||
table.insert(attrib.value, { tag = tag, val = val })
|
|
||||||
else
|
|
||||||
pos = pos - 3
|
|
||||||
end
|
|
||||||
until( name_len ~= 0 )
|
|
||||||
|
|
||||||
-- do minimal decoding
|
-- do minimal decoding
|
||||||
for _, av in ipairs(attrib.value) do
|
for _, av in ipairs(attrib.value) do
|
||||||
|
|||||||
Reference in New Issue
Block a user