From 338adf05bad3f39b16d9e1d9f531c4e05b965756 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 27 Jan 2021 20:14:55 +0100 Subject: [PATCH] interface.get_transaction: stricter sanitisation in particular, Transaction.__init__ allows leading/trailing whitespaces --- electrum/interface.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/electrum/interface.py b/electrum/interface.py index 42c38b223..4d6cfc7ad 100644 --- a/electrum/interface.py +++ b/electrum/interface.py @@ -917,6 +917,8 @@ class Interface(Logger): raise Exception(f"{repr(tx_hash)} is not a txid") raw = await self.session.send_request('blockchain.transaction.get', [tx_hash], timeout=timeout) # validate response + if not is_hex_str(raw): + raise RequestCorrupted(f"received garbage (non-hex) as tx data (txid {tx_hash}): {raw!r}") tx = Transaction(raw) try: tx.deserialize() # see if raises