From 48f339ac827f10bef976e71c7ab76968005be998 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 27 Apr 2019 15:59:56 -0700 Subject: [PATCH] modules/m_event: Tweak conditions for is_power_event(). --- modules/m_event.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/m_event.cc b/modules/m_event.cc index 4258dec1d..65a546909 100644 --- a/modules/m_event.cc +++ b/modules/m_event.cc @@ -1242,6 +1242,9 @@ bool IRCD_MODULE_EXPORT ircd::m::event::auth::is_power_event(const m::event &event) { + if(!json::get<"type"_>(event)) + return false; + if(json::get<"type"_>(event) == "m.room.create") return true; @@ -1254,7 +1257,10 @@ ircd::m::event::auth::is_power_event(const m::event &event) if(json::get<"type"_>(event) != "m.room.member") return false; - if(at<"sender"_>(event) == at<"state_key"_>(event)) + if(!json::get<"sender"_>(event) || !json::get<"state_key"_>(event)) + return false; + + if(json::get<"sender"_>(event) == json::get<"state_key"_>(event)) return false; if(membership(event) == "leave" || membership(event) == "ban")