mirror of
https://github.com/nmap/nmap.git
synced 2025-12-20 22:49:01 +00:00
Adds optional offset parameter to msrpctypes.lua
This commit is contained in:
@@ -4524,14 +4524,17 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Unmarshalls a null-terminated Unicode string (LPTSTR datatype)
|
--- Unmarshalls a null-terminated Unicode string (LPTSTR datatype)
|
||||||
-- @param w_str The data being processed
|
-- @param w_str The data being processed
|
||||||
-- @param startpos The current position within the data
|
-- @param startpos The current position within the data
|
||||||
|
-- @param offset [optional] Sets the number of bytes to be skipped from startpos
|
||||||
-- @return The new position
|
-- @return The new position
|
||||||
-- @return The unmarshalled string
|
-- @return The unmarshalled string
|
||||||
function unmarshall_lptstr(w_str, startpos)
|
function unmarshall_lptstr(w_str, startpos, offset)
|
||||||
|
|
||||||
|
offset = offset or 0
|
||||||
|
|
||||||
local _
|
local _
|
||||||
local endpos = startpos
|
local endpos = startpos + offset
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
_, endpos = w_str:find("\0\0", endpos, true)
|
_, endpos = w_str:find("\0\0", endpos, true)
|
||||||
@@ -4540,7 +4543,7 @@ function unmarshall_lptstr(w_str, startpos)
|
|||||||
end
|
end
|
||||||
until endpos % 2 == 0
|
until endpos % 2 == 0
|
||||||
|
|
||||||
return endpos + 1, w_str:sub(startpos, endpos)
|
return endpos + 1, w_str:sub(startpos + offset, endpos)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user