aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-05 15:20:58 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-09-05 15:20:58 +0200
commit66127730592eadf9ee717a53a521ac2ec14f1051 (patch)
treeb5e92497f41c0051323745a8289e17577f015a9b
parent1e263a32fcbc44985e474a626393494a81f15e37 (diff)
downloadlibquotient-66127730592eadf9ee717a53a521ac2ec14f1051.tar.gz
libquotient-66127730592eadf9ee717a53a521ac2ec14f1051.zip
sendToDevice: fix unintended slicing
Ironically, this slicing would not break anything as all the necessary data are saved in the Event parent class; but the code is very fragile and scary.
-rw-r--r--lib/connection.cpp2
-rw-r--r--lib/connection.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index d9268028..53c99969 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -2471,7 +2471,7 @@ void Connection::startKeyVerificationSession(const QString& deviceId)
}
void Connection::sendToDevice(const QString& targetUserId,
- const QString& targetDeviceId, Event event,
+ const QString& targetDeviceId, const Event& event,
bool encrypted)
{
const auto contentJson =
diff --git a/lib/connection.h b/lib/connection.h
index 5afcfc2f..79c23c9a 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -336,7 +336,7 @@ public:
// This assumes that an olm session already exists. If it doesn't, no message is sent.
void sendToDevice(const QString& targetUserId, const QString& targetDeviceId,
- Event event, bool encrypted);
+ const Event& event, bool encrypted);
/// Returns true if this megolm session comes from a verified device
bool isVerifiedSession(const QString& megolmSessionId) const;