From 98dab122f9fd9afd9c762085aa04e11a2bb19140 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Thu, 29 Nov 2018 14:58:26 +0100 Subject: [PATCH] passphrase: use same max length as T1 --- src/apps/common/request_passphrase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/apps/common/request_passphrase.py b/src/apps/common/request_passphrase.py index 08e72c9a9..096f74d8b 100644 --- a/src/apps/common/request_passphrase.py +++ b/src/apps/common/request_passphrase.py @@ -1,3 +1,5 @@ +from micropython import const + from trezor import ui, wire from trezor.messages import ButtonRequestType, MessageType, PassphraseSourceType from trezor.messages.ButtonRequest import ButtonRequest @@ -10,6 +12,8 @@ from trezor.ui.text import Text from apps.common import storage from apps.common.cache import get_state +_MAX_PASSPHRASE_LEN = const(50) + @ui.layout async def request_passphrase_entry(ctx): @@ -67,6 +71,8 @@ async def request_passphrase(ctx): else: on_device = storage.get_passphrase_source() == PassphraseSourceType.DEVICE passphrase = await request_passphrase_ack(ctx, on_device) + if len(passphrase) > _MAX_PASSPHRASE_LEN: + raise wire.DataError("Maximum passphrase length is %d" % _MAX_PASSPHRASE_LEN) return passphrase