better truncation handling

This commit is contained in:
Robin Appelman 2023-03-16 23:23:09 +01:00
commit 9a11408237
2 changed files with 14 additions and 10 deletions

View file

@ -24,6 +24,9 @@ impl<'a> RawEvent<'a> {
}
fn event_parser(input: &str) -> Result<RawEvent> {
if input.len() < 30 {
return Err(Error::Truncated);
}
let date = RawDate(&input[0..21]);
let (input, subject) = subject_parser(&input[23..])?;