1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
There is still an issue with the history keeping the old password, though
This commit is contained in:
tux3 2015-12-14 23:27:12 +01:00
parent 9a6ad04909
commit 63644050f3
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 6 additions and 1 deletions

View File

@ -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.size();
return QByteArray();
}
int sz = data.size() - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
uint8_t decrypted[sz];
if (!tox_pass_key_decrypt(reinterpret_cast<const uint8_t*>(data.data()), data.size(),

View File

@ -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<uint8_t *>(pic.data()), salt);