mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Make sure groupId and groupLevel are set in KeePass1Reader::readGroup().
This commit is contained in:
parent
2be045eb8f
commit
1f5564760f
@ -387,9 +387,12 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
group->setParent(m_tmpParent);
|
group->setParent(m_tmpParent);
|
||||||
|
|
||||||
TimeInfo timeInfo;
|
TimeInfo timeInfo;
|
||||||
// TODO: make sure these are initalized
|
|
||||||
quint32 groupId;
|
quint32 groupId;
|
||||||
quint32 groupLevel;
|
quint32 groupLevel;
|
||||||
|
bool groupIdSet = false;
|
||||||
|
bool groupLevelSet = false;
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
bool reachedEnd = false;
|
bool reachedEnd = false;
|
||||||
|
|
||||||
@ -419,6 +422,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
return Q_NULLPTR;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||||
|
groupIdSet = true;
|
||||||
break;
|
break;
|
||||||
case 0x0002:
|
case 0x0002:
|
||||||
group->setName(QString::fromUtf8(fieldData.constData()));
|
group->setName(QString::fromUtf8(fieldData.constData()));
|
||||||
@ -483,6 +487,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
return Q_NULLPTR;
|
return Q_NULLPTR;
|
||||||
}
|
}
|
||||||
groupLevel = Endian::bytesToUInt16(fieldData, KeePass1::BYTEORDER);
|
groupLevel = Endian::bytesToUInt16(fieldData, KeePass1::BYTEORDER);
|
||||||
|
groupLevelSet = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x0009:
|
case 0x0009:
|
||||||
@ -497,6 +502,10 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
}
|
}
|
||||||
} while (!reachedEnd);
|
} while (!reachedEnd);
|
||||||
|
|
||||||
|
if (!groupIdSet || !groupLevelSet) {
|
||||||
|
return Q_NULLPTR;
|
||||||
|
}
|
||||||
|
|
||||||
group->setUuid(Uuid::random());
|
group->setUuid(Uuid::random());
|
||||||
group->setTimeInfo(timeInfo);
|
group->setTimeInfo(timeInfo);
|
||||||
m_groupIds.insert(groupId, group.data());
|
m_groupIds.insert(groupId, group.data());
|
||||||
|
Loading…
Reference in New Issue
Block a user