From b6a36429031f0d2435c0da974fb530c1e21e2643 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 7 Sep 2020 16:57:57 -0400 Subject: [PATCH] netdoc: ignore bad entries in families. Some of these are nicknames, which we can safely ignore. --- tor-netdoc/src/family.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tor-netdoc/src/family.rs b/tor-netdoc/src/family.rs index e3f92d2bf..2bef7bf5f 100644 --- a/tor-netdoc/src/family.rs +++ b/tor-netdoc/src/family.rs @@ -12,6 +12,9 @@ use tor_llcrypto::pk::rsa::RSAIdentity; /// belong to the same family if and only if each one lists the other /// as belonging to its family. /// +/// NOTE: when parsing, this type always discards incorrectly-formatted +/// entries, including entries that are only nicknames. +/// /// TODO: This type probably belongs in a different crate. pub struct RelayFamily(Vec); @@ -34,6 +37,7 @@ impl std::str::FromStr for RelayFamily { let v: Result> = s .split(crate::tokenize::is_sp) .map(|e| e.parse::().map(|v| v.into())) + .filter(Result::is_ok) .collect(); Ok(RelayFamily(v?)) }