util.format: Allow newlines but ensure following lines are indented
This should a) prevent injection of text that looks like legitimate log
lines and b) not mangle tracebacks.
--- a/util/format.lua Sat Jul 03 04:24:13 2021 +0200
+++ b/util/format.lua Sat Jul 03 04:29:25 2021 +0200
@@ -60,7 +60,7 @@
args[i] = dump(arg);
spec = "%s";
elseif option == "s" then
- args[i] = tostring(arg):gsub("[%z\1-\31\127]", control_symbols);
+ args[i] = tostring(arg):gsub("[%z\1-\8\11-\31\127]", control_symbols):gsub("\n\t?", "\n\t");
elseif type(arg) ~= "number" then -- arg isn't number as expected?
args[i] = tostring(arg);
spec = "[%s]";