From 1add9bea1ce1359a0a0f52c6328d493c1d730161 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 20 May 2019 18:13:10 -0400 Subject: [PATCH] Reject oversized addr messages --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index 7f94090..bdb8aa1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,6 +135,12 @@ pub fn scan_node(scan_time: Instant, node: SocketAddr) { } }, NetworkMessage::Addr(addrs) => { + if addrs.len() > 1000 { + state_lock.fail_reason = AddressState::ProtocolViolation; + printer.add_line(format!("Updating {} to ProtocolViolation due to oversized addr: {}", node, addrs.len()), true); + state_lock.recvd_addrs = false; + return future::err(()); + } state_lock.recvd_addrs = true; unsafe { DATA_STORE.as_ref().unwrap() }.add_fresh_nodes(&addrs); }, -- 2.39.5