diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-09-26 01:09:11 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-09-26 13:11:54 +0300 |
commit | c44056a9ff33bec9aa2b74b656c6ebefcd73aaeb (patch) | |
tree | fac64699911d052cb492c5423a9269592fade18d /melib/src/email/parser.rs | |
parent | 6d40a57a2e3d04dcdb20d596869303b6feb464af (diff) |
melib: fix bug in parser::parts
At a certain point when expecting a line terminator parts() checks for
'\n' but not '\r\n'. This resulted in all multipart attachments coming
from b"\r\n" sources like IMAP having only one part when parsed.
Diffstat (limited to 'melib/src/email/parser.rs')
-rw-r--r-- | melib/src/email/parser.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/melib/src/email/parser.rs b/melib/src/email/parser.rs index 9938b10b..80828530 100644 --- a/melib/src/email/parser.rs +++ b/melib/src/email/parser.rs @@ -761,7 +761,10 @@ fn parts_f<'a>(input: &'a [u8], boundary: &[u8]) -> IResult<&'a [u8], Vec<&'a [u } ret.push(&input[0..end - 2]); input = &input[end + boundary.len()..]; - if input.len() < 2 || input[0] != b'\n' || &input[0..2] == b"--" { + if input.len() < 2 + || (input[0] != b'\n' && &input[0..2] != b"\r\n") + || &input[0..2] == b"--" + { break; } if input[0] == b'\n' { |