From 9f9cc5d084760a4ecefce56df4796f5ddbad88a7 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 12:35:59 -0700 Subject: [PATCH] Added character limits --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8907f3f..0ec0960 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,7 +98,15 @@ pub fn main() -> Result<(), std::io::Error> { break; }, - _ => { pb.add_char(*q); } + + // Only process sane characters + 'a'..='z' | 'A'..='Z' | '0'..='9' + |'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')' + |'?'|'~'|','|'.'|'['|']' + |'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';' + => { pb.add_char(*q); }, + + _ => {} }; } else { match c.unwrap() {