fix(legacy): fix maximum pin length when upgrading from old storage format

onvej-sl/gcc-11-legacy-fix
Ondřej Vejpustek 3 years ago
parent cec1f39a90
commit effd6e6596

@ -319,7 +319,7 @@ static secbool config_upgrade_v10(void) {
storage_unlock(PIN_EMPTY, PIN_EMPTY_LEN, NULL);
if (config.has_pin) {
storage_change_pin(PIN_EMPTY, PIN_EMPTY_LEN, (const uint8_t *)config.pin,
strnlen(config.pin, MAX_PIN_LEN), NULL, NULL);
strnlen(config.pin, MAX_OLD_PIN_LEN), NULL, NULL);
}
while (pin_wait != 0) {

@ -56,6 +56,8 @@ typedef struct {
STORAGE_BYTES(public_key, 33);
} StorageHDNode;
#define MAX_OLD_PIN_LEN 9
typedef struct _Storage {
uint32_t version;
@ -63,7 +65,7 @@ typedef struct _Storage {
STORAGE_STRING(mnemonic, 241)
STORAGE_BOOL(passphrase_protection)
STORAGE_UINT32(pin_failed_attempts)
STORAGE_STRING(pin, 10)
STORAGE_STRING(pin, MAX_OLD_PIN_LEN + 1)
STORAGE_STRING(language, 17)
STORAGE_STRING(label, 33)
STORAGE_BOOL(imported)

Loading…
Cancel
Save