mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix KeePass2Repair to retain multi-byte UTF-8 chars.
Since char is (often) unsigned the ch < 0x20 check matched all multi-byte encoded UTF-8 chars.
This commit is contained in:
parent
8a92cec03f
commit
208b803fbe
@ -66,7 +66,7 @@ KeePass2Repair::RepairResult KeePass2Repair::repairDatabase(QIODevice* device, c
|
||||
|
||||
// try to fix broken databases because of bug #392
|
||||
for (int i = (xmlData.size() - 1); i >= 0; i--) {
|
||||
char ch = xmlData.at(i);
|
||||
quint8 ch = static_cast<quint8>(xmlData.at(i));
|
||||
if (ch < 0x20 && ch != 0x09 && ch != 0x0A && ch != 0x0D) {
|
||||
xmlData.remove(i, 1);
|
||||
repairAction = true;
|
||||
|
@ -133,7 +133,7 @@ void TestKeePass2Writer::testRepair()
|
||||
{
|
||||
QString brokenDbFilename = QString(KEEPASSX_TEST_DATA_DIR).append("/bug392.kdbx");
|
||||
// master password = test
|
||||
// entry username: testuser\x10
|
||||
// entry username: testuser\x10\x20AC
|
||||
// entry password: testpw
|
||||
CompositeKey key;
|
||||
key.addKey(PasswordKey("test"));
|
||||
@ -153,7 +153,7 @@ void TestKeePass2Writer::testRepair()
|
||||
QVERIFY(dbRepaired);
|
||||
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().size(), 1);
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->username(), QString("testuser"));
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->username(), QString("testuser").append(0x20AC));
|
||||
QCOMPARE(dbRepaired->rootGroup()->entries().at(0)->password(), QString("testpw"));
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user