]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix Pong response attempt-to-encode-oversize-msg panic
authorMatt Corallo <git@bluematt.me>
Wed, 27 Jun 2018 20:59:21 +0000 (16:59 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 27 Jun 2018 21:00:05 +0000 (17:00 -0400)
src/ln/peer_handler.rs

index aec3a32e945b3f773c0519e46aec957696d1f50c..86e2553623d2405232c97c735f548e7fb84bb04b 100644 (file)
@@ -409,8 +409,10 @@ impl<Descriptor: SocketDescriptor> PeerManager<Descriptor> {
 
                                                                                        18 => {
                                                                                                let msg = try_potential_decodeerror!(msgs::Ping::decode(&msg_data[2..]));
-                                                                                               let resp = msgs::Pong { byteslen: msg.ponglen };
-                                                                                               encode_and_send_msg!(resp, 19);
+                                                                                               if msg.ponglen < 65532 {
+                                                                                                       let resp = msgs::Pong { byteslen: msg.ponglen };
+                                                                                                       encode_and_send_msg!(resp, 19);
+                                                                                               }
                                                                                        },
                                                                                        19 => {
                                                                                                try_potential_decodeerror!(msgs::Pong::decode(&msg_data[2..]));