From 10a284f6eea7eca75a463728440e6cc87ef849ca Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 13 Nov 2018 16:33:14 +0100 Subject: [PATCH] src/apps/wallet/sign_tx: make check for OMNI more strict --- src/apps/wallet/sign_tx/omni.py | 2 +- tests/test_apps.wallet.signtx.omni.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apps/wallet/sign_tx/omni.py b/src/apps/wallet/sign_tx/omni.py index 0b6f63d7ae..a475d2826c 100644 --- a/src/apps/wallet/sign_tx/omni.py +++ b/src/apps/wallet/sign_tx/omni.py @@ -6,7 +6,7 @@ currencies = {1: "OMNI", 2: "tOMNI", 3: "MAID", 31: "USDT"} def is_valid(data: bytes) -> bool: - return data[:4] == b"omni" + return len(data) >= 8 and data[:4] == b"omni" def parse(data: bytes) -> bool: diff --git a/tests/test_apps.wallet.signtx.omni.py b/tests/test_apps.wallet.signtx.omni.py index 4d1c26ece9..119599ef0c 100644 --- a/tests/test_apps.wallet.signtx.omni.py +++ b/tests/test_apps.wallet.signtx.omni.py @@ -6,7 +6,9 @@ class TestSignTxOmni(unittest.TestCase): def test_is_valid(self): VECTORS = { - "6f6d6e69000000000000001f000000002b752ee0": True, + "6f6d6e69": False, + "6f6d6e69000000": False, + "6f6d6e6900000000": True, "6f6d6e69000000000000001f0000000020c85580": True, "0f6d6e69000000000000001f0000000020c85580": False, "6f6d6e69000000000000001f0000000020c8558000": True,