mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #2683
There is still an issue with the history keeping the old password, though
This commit is contained in:
parent
9a6ad04909
commit
63644050f3
|
@ -75,6 +75,11 @@ QByteArray Core::decryptData(const QByteArray &data)
|
||||||
|
|
||||||
QByteArray Core::decryptData(const QByteArray& data, const TOX_PASS_KEY& encryptionKey)
|
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;
|
int sz = data.size() - TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
|
||||||
uint8_t decrypted[sz];
|
uint8_t decrypted[sz];
|
||||||
if (!tox_pass_key_decrypt(reinterpret_cast<const uint8_t*>(data.data()), data.size(),
|
if (!tox_pass_key_decrypt(reinterpret_cast<const uint8_t*>(data.data()), data.size(),
|
||||||
|
|
|
@ -369,7 +369,7 @@ QByteArray Profile::loadAvatarData(const QString &ownerId)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
QByteArray pic = file.readAll();
|
QByteArray pic = file.readAll();
|
||||||
if (encrypted)
|
if (encrypted && !pic.isEmpty())
|
||||||
{
|
{
|
||||||
uint8_t salt[TOX_PASS_SALT_LENGTH];
|
uint8_t salt[TOX_PASS_SALT_LENGTH];
|
||||||
tox_get_salt(reinterpret_cast<uint8_t *>(pic.data()), salt);
|
tox_get_salt(reinterpret_cast<uint8_t *>(pic.data()), salt);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user