From: Matt Corallo Date: Tue, 20 Mar 2018 20:41:33 +0000 (-0400) Subject: Fix length requirement in peer_handler msg decode X-Git-Tag: v0.0.12~419^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ac3bf5b71d80d0dbdbacfbac1fc9528d09391237;p=rust-lightning Fix length requirement in peer_handler msg decode --- diff --git a/src/ln/peer_handler.rs b/src/ln/peer_handler.rs index 74848ad77..3a0d6b66d 100644 --- a/src/ln/peer_handler.rs +++ b/src/ln/peer_handler.rs @@ -299,7 +299,7 @@ impl PeerManager { let msg_len = try_potential_handleerror!(peer.channel_encryptor.decrypt_length_header(&peer.pending_read_buffer[..])); peer.pending_read_buffer = Vec::with_capacity(msg_len as usize + 16); peer.pending_read_buffer.resize(msg_len as usize + 16, 0); - if msg_len < 2 + 16 { // Need at least the message type tag + if msg_len < 2 { // Need at least the message type tag return Err(PeerHandleError{}); } peer.pending_read_is_header = false;