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,