File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -770,7 +770,14 @@ impl ChannelMonitor {
770
770
( ) => {
771
771
{
772
772
let tx_len = byte_utils:: slice_to_be64( read_bytes!( 8 ) ) ;
773
- let tx: Transaction = unwrap_obj!( serialize:: deserialize( read_bytes!( tx_len) ) ) ;
773
+ let tx_ser = read_bytes!( tx_len) ;
774
+ let tx: Transaction = unwrap_obj!( serialize:: deserialize( tx_ser) ) ;
775
+ if serialize:: serialize( & tx) . unwrap( ) != tx_ser {
776
+ // We check that the tx re-serializes to the same form to ensure there is
777
+ // no extra data, and as rust-bitcoin doesn't handle the 0-input ambiguity
778
+ // all that well.
779
+ return None ;
780
+ }
774
781
775
782
let revocation_key = unwrap_obj!( PublicKey :: from_slice( & secp_ctx, read_bytes!( 33 ) ) ) ;
776
783
let a_htlc_key = unwrap_obj!( PublicKey :: from_slice( & secp_ctx, read_bytes!( 33 ) ) ) ;
You can’t perform that action at this time.
0 commit comments