From: Matt Corallo Date: Wed, 27 Jun 2018 20:59:21 +0000 (-0400) Subject: Fix Pong response attempt-to-encode-oversize-msg panic X-Git-Tag: v0.0.12~402^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=deedc69a64984c46d91c2016d551a11b53aa1e41;p=rust-lightning Fix Pong response attempt-to-encode-oversize-msg panic --- diff --git a/src/ln/peer_handler.rs b/src/ln/peer_handler.rs index aec3a32e9..86e255362 100644 --- a/src/ln/peer_handler.rs +++ b/src/ln/peer_handler.rs @@ -409,8 +409,10 @@ impl PeerManager { 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..]));