Diff

util/stanza.lua @ 12799:3784a8ce0596 0.12 0.12.2

Merge 0.11->0.12
author Kim Alvefur <zash@zash.se>
date Mon, 12 Dec 2022 07:07:13 +0100
parent 12724:5b5b428d67e2
parent 12797:be09ac8300a7
line wrap: on
line diff
--- a/util/stanza.lua	Sun Nov 13 18:16:59 2022 +0100
+++ b/util/stanza.lua	Mon Dec 12 07:07:13 2022 +0100
@@ -34,8 +34,12 @@
 local stanza_mt = { __name = "stanza" };
 stanza_mt.__index = stanza_mt;
 
+-- Basic check for valid XML character data.
+-- Disallow control characters.
+-- Tab U+09 and newline U+0A are allowed.
+-- For attributes, allow the \1 separator between namespace and name.
 local function valid_xml_cdata(str, attr)
-	return not s_find(str, attr and "[^\1\9\10\13\20-~\128-\247]" or "[^\9\10\13\20-~\128-\247]");
+	return not s_find(str, attr and "[^\1\9\10\13\20-\255]" or "[^\9\10\13\20-\255]");
 end
 
 local function check_name(name, name_type)