1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix history-destroying use after free in Core::getSaltFromFile

We returned a shallow copy of the delete[]'d salt buffer

As a result the history consistently failed to decrypt and was removed as corrupted. This is now fixed.
This commit is contained in:
tux3 2015-04-24 01:10:42 +02:00
parent fff2caa0e1
commit 4fc6632d78
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -160,7 +160,7 @@ QByteArray Core::getSaltFromFile(QString filename)
return QByteArray();
}
QByteArray res = QByteArray::fromRawData(reinterpret_cast<const char*>(salt), TOX_PASS_SALT_LENGTH);
QByteArray res(reinterpret_cast<const char*>(salt), TOX_PASS_SALT_LENGTH);
delete[] salt;
return res;
}