From 7e13acfb5c2f2cfbb48c4fd55426a501f40eb506 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 20 May 2019 20:25:39 -0400 Subject: [PATCH] Fix subver regex parsing with spaces --- src/reader.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) { -- 2.39.5