aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-25 20:52:01 +0100
committerKim Alvefur <zash@zash.se>2019-11-25 20:52:01 +0100
commit7954f16d5913ce2383e220c040e36b153ac522e3 (patch)
treeb016011e7c177c36a6f9c301630b7f3458b5f78c /util
parent7fdb06225efa628956ee38d944bd45d811bac358 (diff)
downloadprosody-7954f16d5913ce2383e220c040e36b153ac522e3.tar.gz
prosody-7954f16d5913ce2383e220c040e36b153ac522e3.zip
util.stanza: Check that argument to error_reply is a stanza
Diffstat (limited to 'util')
-rw-r--r--util/stanza.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/stanza.lua b/util/stanza.lua
index 919d983c..24fd4fea 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -448,6 +448,9 @@ end
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