aboutsummaryrefslogtreecommitdiffstats
path: root/util/format.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-03 04:29:25 +0200
committerKim Alvefur <zash@zash.se>2021-07-03 04:29:25 +0200
commit7e09f662cbe7f76753a936bb1aff1952489a9d3c (patch)
treefa1e18477853f3a5a33850b45efd12167ae78389 /util/format.lua
parentf179b18e2bcf524d31cfc547b4b17e7013270c5f (diff)
downloadprosody-7e09f662cbe7f76753a936bb1aff1952489a9d3c.tar.gz
prosody-7e09f662cbe7f76753a936bb1aff1952489a9d3c.zip
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.
Diffstat (limited to 'util/format.lua')
-rw-r--r--util/format.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/format.lua b/util/format.lua
index 52388081..2a29c4f3 100644
--- a/util/format.lua
+++ b/util/format.lua
@@ -60,7 +60,7 @@ local function format(formatstring, ...)
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]";