Software /
code /
prosody
Changeset
11647:0fe6a9a3676f
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 03 Jul 2021 04:29:25 +0200 |
parents | 11646:b6ea0148ad37 |
children | 11648:96d3cbeb9275 |
files | util/format.lua |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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]";