aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2022-02-26 22:22:51 +0100
committerTobias Fella <fella@posteo.de>2022-02-26 22:25:08 +0100
commiteb50b8ebe4447cafe23d5f1d4ca9351e594e917e (patch)
treefc2eeb2443958931911596fad33c59d4a233e0f3 /lib/room.cpp
parent62039b527507aa6c45fbf7ac787da6234d2faac3 (diff)
downloadlibquotient-eb50b8ebe4447cafe23d5f1d4ca9351e594e917e.tar.gz
libquotient-eb50b8ebe4447cafe23d5f1d4ca9351e594e917e.zip
Check that decrypted events are for the current room
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index ea9915c3..d0ac10f9 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1487,7 +1487,13 @@ RoomEventPtr Room::decryptMessage(const EncryptedEvent& encryptedEvent)
// qCWarning(E2EE) << "Encrypted message is empty";
return {};
}
- return encryptedEvent.createDecrypted(decrypted);
+ auto decryptedEvent = encryptedEvent.createDecrypted(decrypted);
+ if (decryptedEvent->roomId() == id()) {
+ return decryptedEvent;
+ } else {
+ qCWarning(E2EE) << "Decrypted event" << encryptedEvent.id() << "not for this room; discarding.";
+ return nullptr;
+ }
#endif // Quotient_E2EE_ENABLED
}