From 981d079d7f1f0704e7731fec0c84e77aa40f40b1 Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Thu, 11 Jun 2020 09:08:50 +0200 Subject: [PATCH] core/signverify: add failsafe for an empty message header --- core/src/apps/common/signverify.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/apps/common/signverify.py b/core/src/apps/common/signverify.py index 0670a79a3c..ad65776065 100644 --- a/core/src/apps/common/signverify.py +++ b/core/src/apps/common/signverify.py @@ -18,6 +18,8 @@ def message_digest(coin: CoinType, message: bytes) -> bytes: h = utils.HashWriter(blake256()) else: h = utils.HashWriter(sha256()) + if not coin.signed_message_header: + raise wire.DataError("Empty message header not allowed.") write_bitcoin_varint(h, len(coin.signed_message_header)) h.extend(coin.signed_message_header) write_bitcoin_varint(h, len(message))