|
|
117356 |
Index: bogofilter/src/mime.c
|
|
|
117356 |
===================================================================
|
|
|
117356 |
--- bogofilter/src/mime.c (revision 7022)
|
|
|
117356 |
+++ bogofilter/src/mime.c (revision 7023)
|
|
|
117356 |
@@ -279,6 +279,25 @@
|
|
|
117356 |
mime_push(parent);
|
|
|
117356 |
}
|
|
|
117356 |
|
|
|
117356 |
+static bool is_final_boundary(
|
|
|
117356 |
+ const byte *ins,
|
|
|
117356 |
+ size_t inlen,
|
|
|
117356 |
+ size_t blen
|
|
|
117356 |
+)
|
|
|
117356 |
+{
|
|
|
117356 |
+ if (inlen >= 5
|
|
|
117356 |
+ && inlen >= blen + 2
|
|
|
117356 |
+ && ins[0] == '-'
|
|
|
117356 |
+ && ins[1] == '-'
|
|
|
117356 |
+ && ins[blen+2] == '-'
|
|
|
117356 |
+ && ins[blen+3] == '-')
|
|
|
117356 |
+ {
|
|
|
117356 |
+ return true;
|
|
|
117356 |
+ }
|
|
|
117356 |
+ return false;
|
|
|
117356 |
+}
|
|
|
117356 |
+
|
|
|
117356 |
+
|
|
|
117356 |
/**
|
|
|
117356 |
* Check if the line given in \a boundary is a boundary of one of the
|
|
|
117356 |
* outer MIME containers and store the results in \a b.
|
|
|
117356 |
@@ -301,28 +320,18 @@
|
|
|
117356 |
(buf[blen - 1] == '\r' || buf[blen - 1] == '\n'))
|
|
|
117356 |
blen--;
|
|
|
117356 |
|
|
|
117356 |
- /* skip initial -- */
|
|
|
117356 |
- buf += 2;
|
|
|
117356 |
- blen -= 2;
|
|
|
117356 |
-
|
|
|
117356 |
- /* skip and note ending --, if any */
|
|
|
117356 |
- if (blen > 2 && buf[blen - 1] == '-' && buf[blen - 2] == '-') {
|
|
|
117356 |
- b->is_final = true;
|
|
|
117356 |
- blen -= 2;
|
|
|
117356 |
- } else {
|
|
|
117356 |
- b->is_final = false;
|
|
|
117356 |
- }
|
|
|
117356 |
-
|
|
|
117356 |
/* search stack for matching boundary, in reverse order */
|
|
|
117356 |
for (ptr = mime_stack_bot; ptr != NULL; ptr = ptr->parent)
|
|
|
117356 |
{
|
|
|
117356 |
if (is_mime_container(ptr)
|
|
|
117356 |
&& ptr->boundary != NULL
|
|
|
117356 |
- && ptr->boundary_len == blen
|
|
|
117356 |
- && (memcmp(ptr->boundary, buf, blen) == 0))
|
|
|
117356 |
+ && (ptr->boundary_len + 2 == blen
|
|
|
117356 |
+ || ptr->boundary_len + 4 == blen)
|
|
|
117356 |
+ && (memcmp(ptr->boundary, buf + 2, ptr->boundary_len) == 0))
|
|
|
117356 |
{
|
|
|
117356 |
b->depth = ptr->depth;
|
|
|
117356 |
b->is_valid = true;
|
|
|
117356 |
+ b->is_final = is_final_boundary(buf, blen, ptr->boundary_len);
|
|
|
117356 |
break;
|
|
|
117356 |
}
|
|
|
117356 |
}
|
|
|
117356 |
Index: bogofilter/NEWS
|
|
|
117356 |
===================================================================
|
|
|
117356 |
--- bogofilter/NEWS (revision 7022)
|
|
|
117356 |
+++ bogofilter/NEWS (revision 7023)
|
|
|
117356 |
@@ -15,6 +15,15 @@
|
|
|
117356 |
|
|
|
117356 |
-------------------------------------------------------------------------------
|
|
|
117356 |
|
|
|
117356 |
+ 2015-02-25
|
|
|
117356 |
+
|
|
|
117356 |
+ * Fix the lexer to handle MIME multipart messages properly when the
|
|
|
117356 |
+ boundary ended in "--". The parser would previously never find the
|
|
|
117356 |
+ MIME parts because it mistook all boundaries ending in two dashes to
|
|
|
117356 |
+ be the final boundary of the multipart, rather than checking if the
|
|
|
117356 |
+ two dashes were extra.
|
|
|
117356 |
+ Reported by Matt Garretson to the bogofilter mailing list today.
|
|
|
117356 |
+
|
|
|
117356 |
2014-07-10
|
|
|
117356 |
|
|
|
117356 |
* Take patch from Julius Plenz to fix a bug in the charset converter
|