projects
/
dnsseed-rust
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0986f75
)
Reject oversized addr messages
author
Matt Corallo
<git@bluematt.me>
Mon, 20 May 2019 22:13:10 +0000
(18:13 -0400)
committer
Matt Corallo
<git@bluematt.me>
Mon, 20 May 2019 22:15:37 +0000
(18:15 -0400)
src/main.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index 7f9409055c6102fca15108528acf8db37ab5c660..bdb8aa1d81bc2f95b908680cfe10413c3f3fc90d 100644
(file)
--- 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);
},