1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Fix a bug introduced in r32678

string.gsub returns 2 values, the new string and the number of
replacements made. It also has a 4th argument, the number of
replacements to make. So when you use the return value of gsub as the
3rd argument, and no replacements were made, it instructs the next call
to not make any replacements. Thanks to Ron Bowes for reporting this
issue.
This commit is contained in:
dmiller
2014-01-29 13:24:30 +00:00
parent d6288c5280
commit cd7df91ce0

View File

@@ -317,7 +317,8 @@ do
local against = against_name(self.host, self.port);
local function replace(fmt, pattern, repl)
-- Escape each % twice: once for gsub, and once for print_debug.
return gsub(fmt, pattern, gsub(repl, "%%", "%%%%%%%%"));
local r = gsub(repl, "%%", "%%%%%%%%")
return gsub(fmt, pattern, r);
end
if debugging() > 1 then
fmt = replace(fmt, "%%THREAD_AGAINST", self.info..against);