From 63644050f392339178897789ff29ffa27ac6d501 Mon Sep 17 00:00:00 2001 From: tux3 Date: Mon, 14 Dec 2015 23:27:12 +0100 Subject: [PATCH] Fix #2683 There is still an issue with the history keeping the old password, though --- src/core/coreencryption.cpp | 5 +++++ src/persistence/profile.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/coreencryption.cpp b/src/core/coreencryption.cpp index 8a182b972..ae1813e86 100644 --- a/src/core/coreencryption.cpp +++ b/src/core/coreencryption.cpp @@ -75,6 +75,11 @@ QByteArray Core::decryptData(const QByteArray &data) QByteArray Core::decryptData(const QByteArray& data, const TOX_PASS_KEY& encryptionKey) { + if (data.size() < TOX_PASS_ENCRYPTION_EXTRA_LENGTH) + { + qWarning() << "Not enough data:"<(data.data()), data.size(), diff --git a/src/persistence/profile.cpp b/src/persistence/profile.cpp index d0e92e979..bd263b924 100644 --- a/src/persistence/profile.cpp +++ b/src/persistence/profile.cpp @@ -369,7 +369,7 @@ QByteArray Profile::loadAvatarData(const QString &ownerId) return {}; QByteArray pic = file.readAll(); - if (encrypted) + if (encrypted && !pic.isEmpty()) { uint8_t salt[TOX_PASS_SALT_LENGTH]; tox_get_salt(reinterpret_cast(pic.data()), salt);