aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-02 15:39:40 +0100
committerKim Alvefur <zash@zash.se>2019-11-02 15:39:40 +0100
commite131bbd3a4cc84f05d44be877ed2201031e2f810 (patch)
tree3df0cf83cda87763c6194c826d16b8e88875a278
parentb1516ea8f0c1121b47eae70e9f18755298026a60 (diff)
downloadprosody-e131bbd3a4cc84f05d44be877ed2201031e2f810.tar.gz
prosody-e131bbd3a4cc84f05d44be877ed2201031e2f810.zip
mod_c2s: Validate that a 'to' attribute exists at all
Prevents traceback from nameprep(nil)
-rw-r--r--plugins/mod_c2s.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index 02a0c5eb..aec0370d 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -56,6 +56,11 @@ local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
function stream_callbacks.streamopened(session, attr)
local send = session.send;
+ if not attr.to then
+ session:close{ condition = "improper-addressing",
+ text = "A 'to' attribute is required on stream headers" };
+ return;
+ end
local host = nameprep(attr.to);
if not host then
session:close{ condition = "improper-addressing",