mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 02:19:04 +00:00
Lua 5.2 allows null chars in patterns, so this hack is unnecessary
This commit is contained in:
@@ -1348,22 +1348,7 @@ end
|
||||
local function do_replacements(mod, line)
|
||||
if(mod.replace) then
|
||||
for _, v in pairs(mod.replace) do
|
||||
|
||||
-- It looks like Lua doesn't like replacing the null character, so have a sidecase for it
|
||||
if(v[1] == string.char(0)) then
|
||||
local newline = ""
|
||||
for i = 1, #line, 1 do
|
||||
local char = string.sub(line, i, i)
|
||||
if(string.byte(char) == 0) then
|
||||
newline = newline .. v[2]
|
||||
else
|
||||
newline = newline .. char
|
||||
end
|
||||
end
|
||||
line = newline
|
||||
else
|
||||
line = string.gsub(line, v[1], v[2])
|
||||
end
|
||||
line = string.gsub(line, v[1], v[2])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user