From: Matt Corallo Date: Mon, 20 May 2019 22:13:10 +0000 (-0400) Subject: Reject oversized addr messages X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1add9bea1ce1359a0a0f52c6328d493c1d730161;p=dnsseed-rust Reject oversized addr messages --- 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); },