From 306b35cdf0dedae97d376acad9196ed77ea41772 Mon Sep 17 00:00:00 2001 From: Philipp Korber Date: Thu, 14 Mar 2019 14:37:44 +0100 Subject: fix(headers): Make it impossible to have "fake" encoded words. With certain Words/Phrases it was possible to have encoded words like text as input without the library encoding them. --- headers/src/header_components/word.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headers/src/header_components/word.rs b/headers/src/header_components/word.rs index ed8b065..84713ca 100644 --- a/headers/src/header_components/word.rs +++ b/headers/src/header_components/word.rs @@ -74,7 +74,7 @@ pub fn do_encode_word<'a,'b: 'a>( let input: &str = &*word.input; let mail_type = handle.mail_type(); handle.write_if(input, |input| { - (!input.starts_with("=?")) + (!input.contains("=?")) && input.chars().all( |ch| is_atext( ch, mail_type ) ) }).handle_condition_failure(|handle| { -- cgit v1.2.3