mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-26 09:21:21 -05:00
Raise an error when parsing duplicate attributes/attachments.
This commit is contained in:
parent
3ea0592b53
commit
eb22f0a2d8
@ -825,7 +825,13 @@ void KeePass2XmlReader::parseEntryString(Entry* entry)
|
||||
}
|
||||
|
||||
if (keySet && valueSet) {
|
||||
entry->attributes()->set(key, value, protect);
|
||||
// the default attributes are always there so additionally check if it's empty
|
||||
if (entry->attributes()->hasKey(key) && !entry->attributes()->value(key).isEmpty()) {
|
||||
raiseError("Duplicate custom attribute found");
|
||||
}
|
||||
else {
|
||||
entry->attributes()->set(key, value, protect);
|
||||
}
|
||||
}
|
||||
else {
|
||||
raiseError("Entry string key or value missing");
|
||||
@ -874,7 +880,12 @@ QPair<QString, QString> KeePass2XmlReader::parseEntryBinary(Entry* entry)
|
||||
}
|
||||
|
||||
if (keySet && valueSet) {
|
||||
entry->attachments()->set(key, value);
|
||||
if (entry->attachments()->hasKey(key)) {
|
||||
raiseError("Duplicate attachment found");
|
||||
}
|
||||
else {
|
||||
entry->attachments()->set(key, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
raiseError("Entry binary key or value missing");
|
||||
|
Loading…
x
Reference in New Issue
Block a user