From 54da2ab6f7fec145d05ac8682c50a776bb993880 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 25 Nov 2019 20:52:03 +0100 Subject: util.stanza: Check that argument to error_reply is NOT a stanza of type error Replying to an error is Very Bad --- util/stanza.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/stanza.lua') diff --git a/util/stanza.lua b/util/stanza.lua index 24fd4fea..8ff1aae3 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -450,6 +450,8 @@ 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)); + elseif orig.attr.type == "error" then + error("bad argument to error_reply: got stanza of type error which must not be replied to"); end local t = reply(orig); t.attr.type = "error"; -- cgit v1.2.3