mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix minor TOTP issues
* Fix #5105 - prevent divide-by-zero segfault due to invalid TOTP settings * Clear TOTP settings if attributes are removed
This commit is contained in:
parent
747be8d629
commit
d6857e654f
@ -481,6 +481,8 @@ void Entry::updateTotp()
|
||||
m_attributes->value(Totp::ATTRIBUTE_SEED));
|
||||
} else if (m_attributes->contains(Totp::ATTRIBUTE_OTP)) {
|
||||
m_data.totpSettings = Totp::parseSettings(m_attributes->value(Totp::ATTRIBUTE_OTP));
|
||||
} else {
|
||||
m_data.totpSettings.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ QSharedPointer<Totp::Settings> Totp::parseSettings(const QString& rawSettings, c
|
||||
}
|
||||
|
||||
// Bound digits and step
|
||||
settings->digits = qMax(1u, settings->digits);
|
||||
settings->digits = qBound(1u, settings->digits, 10u);
|
||||
settings->step = qBound(1u, settings->step, 60u);
|
||||
|
||||
// Detect custom settings, used by setup GUI
|
||||
|
Loading…
Reference in New Issue
Block a user