[gmime] Properly handle Content-Type: multipart/mixed; boundary="From "
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Properly handle Content-Type: multipart/mixed; boundary="From "
- Date: Sat, 20 Oct 2012 15:11:28 +0000 (UTC)
commit c2f418ff2c6817b389fce497a11006a6e01772f3
Author: Jeffrey Stedfast <fejj gnome org>
Date: Fri Oct 19 23:07:39 2012 -0400
Properly handle Content-Type: multipart/mixed; boundary="From "
2012-10-19 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-parser.c (parser_push_boundary): Don't use strcmp to
check if the boundary is an mbox boundary, use a direct pointer
comparison so that we can handle Content-Type boundary parameters
with a value of "From "
ChangeLog | 7 +++++++
gmime/gmime-parser.c | 12 +++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index accfce1..73442ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-10-19 Jeffrey Stedfast <fejj gnome org>
+
+ * gmime/gmime-parser.c (parser_push_boundary): Don't use strcmp to
+ check if the boundary is an mbox boundary, use a direct pointer
+ comparison so that we can handle Content-Type boundary parameters
+ with a value of "From "
+
2012-10-19 Jeffrey Stedfast <jeff xamarin com>
* gmime/gmime-parser.c (parser_step_headers): Don't assume that
diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c
index 9c5ec4f..c74f703 100644
--- a/gmime/gmime-parser.c
+++ b/gmime/gmime-parser.c
@@ -180,6 +180,8 @@ struct _GMimeParserPrivate {
BoundaryStack *bounds;
};
+#define MBOX_BOUNDARY "From "
+#define MBOX_BOUNDARY_LEN 5
static void
parser_push_boundary (GMimeParser *parser, const char *boundary)
@@ -194,10 +196,10 @@ parser_push_boundary (GMimeParser *parser, const char *boundary)
s->parent = priv->bounds;
priv->bounds = s;
- if (!strcmp (boundary, "From ")) {
- s->boundary = g_strdup ("From ");
- s->boundarylen = 5;
- s->boundarylenfinal = 5;
+ if (boundary == MBOX_BOUNDARY) {
+ s->boundary = g_strdup (boundary);
+ s->boundarylen = MBOX_BOUNDARY_LEN;
+ s->boundarylenfinal = MBOX_BOUNDARY_LEN;
} else {
s->boundary = g_strdup_printf ("--%s--", boundary);
s->boundarylen = strlen (boundary) + 2;
@@ -1942,7 +1944,7 @@ parser_construct_message (GMimeParser *parser)
}
if (priv->scan_from) {
- parser_push_boundary (parser, "From ");
+ parser_push_boundary (parser, MBOX_BOUNDARY);
if (priv->respect_content_length && content_length < ULONG_MAX)
priv->bounds->content_end = parser_offset (priv, NULL) + content_length;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]