Changeset

10379:b917602eac04

mod_c2s: Validate that a 'to' attribute exists at all Prevents traceback from nameprep(nil)
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 15:39:40 +0100
parents 10378:04c4750ff8d2
children 10380:18685a5e362e
files plugins/mod_c2s.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_c2s.lua	Sat Nov 02 15:39:01 2019 +0100
+++ b/plugins/mod_c2s.lua	Sat Nov 02 15:39:40 2019 +0100
@@ -56,6 +56,11 @@
 
 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",