]> git.bitcoin.ninja Git - dnsseed-rust/commitdiff
Fix subver regex parsing with spaces
authorMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 00:25:39 +0000 (20:25 -0400)
committerMatt Corallo <git@bluematt.me>
Tue, 21 May 2019 00:25:39 +0000 (20:25 -0400)
src/reader.rs

index 8250aaed871c44b49d794b3be394ec36c213c95d..9c6a400375716010415056c72ae76dae169d1f96 100644 (file)
@@ -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::<Regex>() {
+                                       Ok(res) => res,
+                                       Err(_) => err!(),
+                               });
+                       },
                        "a" => scan_node(Instant::now(), try_parse_next_chunk!(SocketAddr)),
                        "r" => {
                                match try_parse_next_chunk!(u8) {