From deedc69a64984c46d91c2016d551a11b53aa1e41 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 27 Jun 2018 16:59:21 -0400 Subject: [PATCH] Fix Pong response attempt-to-encode-oversize-msg panic --- src/ln/peer_handler.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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..])); -- 2.39.5