]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix length requirement in peer_handler msg decode
authorMatt Corallo <git@bluematt.me>
Tue, 20 Mar 2018 20:41:33 +0000 (16:41 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 20 Mar 2018 20:42:04 +0000 (16:42 -0400)
src/ln/peer_handler.rs

index 74848ad77b361d55741f36368c8534e7420f12b7..3a0d6b66d3578135dbe050cb936d74893b74215c 100644 (file)
@@ -299,7 +299,7 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
                                                                                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;