[evolution-data-server/gnome-41] CamelMimeParser: Correct body content parse when CRLF is used
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-41] CamelMimeParser: Correct body content parse when CRLF is used
- Date: Mon, 17 Jan 2022 15:22:12 +0000 (UTC)
commit 0529c06c864929fca1202698dde3ab02ef537e1d
Author: Milan Crha <mcrha redhat com>
Date: Mon Jan 17 16:18:04 2022 +0100
CamelMimeParser: Correct body content parse when CRLF is used
The ending LF before a message part boundary is removed, but the code
left there the CR, which is a part of the CRLF, in error, thus skip it
as well, to not generate invalid body content.
Related to https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/372
src/camel/camel-mime-parser.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/camel-mime-parser.c b/src/camel/camel-mime-parser.c
index 00d6c6d26..d654c7b85 100644
--- a/src/camel/camel-mime-parser.c
+++ b/src/camel/camel-mime-parser.c
@@ -1547,9 +1547,12 @@ normal_exit:
*data = start;
/* if we hit a boundary, we should not include the closing \n */
- if (onboundary && (inptr - start) > 0)
+ if (onboundary && (inptr - start) > 0) {
*length = inptr-start-1;
- else
+ /* in case it was "\r\n", remove also the "\r" */
+ if (*length > 0 && start[*length - 1] == '\r')
+ *length = (*length) - 1;
+ } else
*length = inptr-start;
/*printf("got %scontent: '%.*s'\n", s->midline?"partial ":"", inptr-start, start);*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]