mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-24 05:31:11 -05:00
Fix base64 check missing '/' as valid character
* Issue introduced in 558cb3d
* Corrects loading of legacy KeePass Key Files that included a '/' in their data section. Fix #2863 and Fix #2834
This commit is contained in:
parent
bc3a7522a2
commit
d6324feafd
@ -205,7 +205,7 @@ namespace Tools
|
||||
|
||||
bool isBase64(const QByteArray& ba)
|
||||
{
|
||||
constexpr auto pattern = R"(^(?:[a-z0-9+]{4})*(?:[a-z0-9+]{3}=|[a-z0-9+]{2}==)?$)";
|
||||
constexpr auto pattern = R"(^(?:[a-z0-9+/]{4})*(?:[a-z0-9+/]{3}=|[a-z0-9+/]{2}==)?$)";
|
||||
QRegExp regexp(pattern, Qt::CaseInsensitive, QRegExp::RegExp2);
|
||||
|
||||
QString base64 = QString::fromLatin1(ba.constData(), ba.size());
|
||||
|
@ -59,6 +59,7 @@ void TestTools::testIsBase64()
|
||||
QVERIFY(Tools::isBase64(QByteArray("12==")));
|
||||
QVERIFY(Tools::isBase64(QByteArray("abcd9876MN==")));
|
||||
QVERIFY(Tools::isBase64(QByteArray("abcd9876DEFGhijkMNO=")));
|
||||
QVERIFY(Tools::isBase64(QByteArray("abcd987/DEFGh+jk/NO=")));
|
||||
QVERIFY(not Tools::isBase64(QByteArray("abcd123==")));
|
||||
QVERIFY(not Tools::isBase64(QByteArray("abc_")));
|
||||
QVERIFY(not Tools::isBase64(QByteArray("123")));
|
||||
|
Loading…
Reference in New Issue
Block a user