From: Matt Corallo Date: Tue, 21 May 2019 00:25:39 +0000 (-0400) Subject: Fix subver regex parsing with spaces X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=7e13acfb5c2f2cfbb48c4fd55426a501f40eb506;p=dnsseed-rust Fix subver regex parsing with spaces --- diff --git a/src/reader.rs b/src/reader.rs index 8250aae..9c6a400 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -43,7 +43,15 @@ pub fn read(store: &'static Store, printer: &'static Printer) { "t" => store.set_u64(U64Setting::RunTimeout, try_parse_next_chunk!(u64)), "v" => store.set_u64(U64Setting::MinProtocolVersion, try_parse_next_chunk!(u64)), "w" => store.set_u64(U64Setting::WasGoodTimeout, try_parse_next_chunk!(u64)), - "s" => store.set_regex(RegexSetting::SubverRegex, try_parse_next_chunk!(Regex)), + "s" => { + if line.len() < 3 || !line.starts_with("s ") { + err!(); + } + store.set_regex(RegexSetting::SubverRegex, match line[2..].parse::() { + Ok(res) => res, + Err(_) => err!(), + }); + }, "a" => scan_node(Instant::now(), try_parse_next_chunk!(SocketAddr)), "r" => { match try_parse_next_chunk!(u8) {