Raise an error when parsing duplicate attributes/attachments.

This commit is contained in:
Felix Geyer 2014-12-03 23:36:53 +01:00
parent 3ea0592b53
commit eb22f0a2d8

View File

@ -825,8 +825,14 @@ void KeePass2XmlReader::parseEntryString(Entry* entry)
}
if (keySet && valueSet) {
// 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,8 +880,13 @@ QPair<QString, QString> KeePass2XmlReader::parseEntryBinary(Entry* entry)
}
if (keySet && valueSet) {
if (entry->attachments()->hasKey(key)) {
raiseError("Duplicate attachment found");
}
else {
entry->attachments()->set(key, value);
}
}
else {
raiseError("Entry binary key or value missing");
}