Diff

util/format.lua @ 12039:e0a8c5b1ab4f

util.format: Ensure metatable __tostring results are also sanitized
author Kim Alvefur <zash@zash.se>
date Mon, 13 Dec 2021 16:34:55 +0100
parent 12036:2ce06f788093
child 12040:337b489532b7
line wrap: on
line diff
--- a/util/format.lua	Sun Dec 12 18:38:40 2021 +0100
+++ b/util/format.lua	Mon Dec 13 16:34:55 2021 +0100
@@ -70,7 +70,8 @@
 			-- No UTF-8 or control characters, assumed to be the common case.
 			return
 		elseif option == "s" and t ~= "string" then
-			args[i] = tostring(arg);
+			arg = tostring(arg);
+			t = "string";
 		end
 
 		if option ~= "s" and option ~= "q" and option ~= "p" then