Diff

util/stanza.lua @ 10444:4eab1f5a4f3b

util.stanza: Check that argument to error_reply is a stanza
author Kim Alvefur <zash@zash.se>
date Mon, 25 Nov 2019 20:52:01 +0100
parent 10443:f28718f46196
child 10445:f53c03ab4357
line wrap: on
line diff
--- a/util/stanza.lua	Mon Nov 25 20:46:55 2019 +0100
+++ b/util/stanza.lua	Mon Nov 25 20:52:01 2019 +0100
@@ -448,6 +448,9 @@
 
 local xmpp_stanzas_attr = { xmlns = xmlns_stanzas };
 local function error_reply(orig, error_type, condition, error_message)
+	if not is_stanza(orig) then
+		error("bad argument to error_reply: expected stanza, got "..type(orig));
+	end
 	local t = reply(orig);
 	t.attr.type = "error";
 	t:tag("error", {type = error_type}) --COMPAT: Some day xmlns:stanzas goes here