From 62810c3dbf787b05671c3df2340b375ad078bd55 Mon Sep 17 00:00:00 2001 From: rewanth Date: Sat, 2 Sep 2017 15:33:28 +0000 Subject: [PATCH] Reverting back to older logic by removing offset param. --- nselib/msrpctypes.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nselib/msrpctypes.lua b/nselib/msrpctypes.lua index 80e4ff762..68e1375e7 100644 --- a/nselib/msrpctypes.lua +++ b/nselib/msrpctypes.lua @@ -4524,17 +4524,14 @@ end --- Unmarshalls a null-terminated Unicode string (LPTSTR datatype) --- @param w_str The data being processed --- @param startpos The current position within the data --- @param offset [optional] Sets the number of bytes to be skipped from startpos +-- @param w_str The data being processed +-- @param startpos The current position within the data -- @return The new position -- @return The unmarshalled string -function unmarshall_lptstr(w_str, startpos, offset) - - offset = offset or 0 +function unmarshall_lptstr(w_str, startpos) local _ - local endpos = startpos + offset + local endpos = startpos repeat _, endpos = w_str:find("\0\0", endpos, true) @@ -4543,7 +4540,7 @@ function unmarshall_lptstr(w_str, startpos, offset) end until endpos % 2 == 0 - return endpos + 1, w_str:sub(startpos + offset, endpos) + return endpos + 1, w_str:sub(startpos, endpos) end