aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_format_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-06-15 23:24:23 +0200
committerKim Alvefur <zash@zash.se>2021-06-15 23:24:23 +0200
commit3f1d93bb4e377a320b4e3edb6c0a959e8f997bb2 (patch)
tree1120fedeba2b4d44d6ca22860b0acecfc9cdd60c /spec/util_format_spec.lua
parente21e4b2b2496ffcc5d620b04cf3e01b71e9982b1 (diff)
downloadprosody-3f1d93bb4e377a320b4e3edb6c0a959e8f997bb2.tar.gz
prosody-3f1d93bb4e377a320b4e3edb6c0a959e8f997bb2.zip
util.format: Escape ASCII control characters in output
This should offer some protection against doing evil things to terminals. Doesn't protect against pure broken UTF-8 garbage however. See #734
Diffstat (limited to 'spec/util_format_spec.lua')
-rw-r--r--spec/util_format_spec.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/util_format_spec.lua b/spec/util_format_spec.lua
index 50509630..a8bcfd97 100644
--- a/spec/util_format_spec.lua
+++ b/spec/util_format_spec.lua
@@ -15,5 +15,10 @@ describe("util.format", function()
assert.equal("[1.5]", format("%d", 1.5));
assert.equal("[7.3786976294838e+19]", format("%d", 73786976294838206464));
end);
+
+ it("escapes ascii control stuff", function ()
+ assert.equal("␁", format("%s", "\1"));
+ end);
+
end);
end);