From 66127730592eadf9ee717a53a521ac2ec14f1051 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 5 Sep 2022 15:20:58 +0200 Subject: 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. --- lib/connection.cpp | 2 +- lib/connection.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3