diff options
-rw-r--r-- | camel/ChangeLog | 10 | ||||
-rw-r--r-- | camel/camel-multipart-signed.c | 17 |
2 files changed, 20 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3114bcf35c..9c5ef6c29e 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2004-12-01 Not Zed <NotZed@Ximian.com> + + ** See bug #69776. + + * camel-multipart-signed.c (parse_boundary): take end of data + argument, so it handles binary data. Use a binary data string + search rather than strstr. + (parse_content): dont bother to append a \0 on the end of the + data, not binary capable. + 2004-11-23 Not Zed <NotZed@Ximian.com> ** See bug #69615. diff --git a/camel/camel-multipart-signed.c b/camel/camel-multipart-signed.c index e25f1c46a4..7599df6216 100644 --- a/camel/camel-multipart-signed.c +++ b/camel/camel-multipart-signed.c @@ -184,11 +184,16 @@ camel_multipart_signed_new (void) /* find the next boundary @bound from @start, return the start of the actual data @end points to the end of the data BEFORE the boundary */ -static char *parse_boundary(char *start, const char *bound, char **end) +static char *parse_boundary(char *start, char *last, const char *bound, char **end) { char *data, *begin; - begin = strstr(start, bound); + while ((begin = memchr(start, bound[0], last-start))) { + if (memcmp(begin, bound, strlen(bound)) == 0) + break; + start = begin+1; + } + if (begin == NULL) return NULL; @@ -233,14 +238,12 @@ parse_content(CamelMultipartSigned *mps) return -1; } - camel_stream_write((CamelStream *)mem, "", 1); - g_byte_array_set_size(mem->buffer, mem->buffer->len-1); last = mem->buffer->data + mem->buffer->len; bound = alloca(strlen(boundary)+5); sprintf(bound, "--%s", boundary); - start = parse_boundary(mem->buffer->data, bound, &end); + start = parse_boundary(mem->buffer->data, last, bound, &end); if (start == NULL || start[0] == 0) return -1; @@ -250,12 +253,12 @@ parse_content(CamelMultipartSigned *mps) g_free(tmp); } - start2 = parse_boundary(start, bound, &end); + start2 = parse_boundary(start, last, bound, &end); if (start2 == NULL || start2[0] == 0) return -1; sprintf(bound, "--%s--", boundary); - post = parse_boundary(start2, bound, &end2); + post = parse_boundary(start2, last, bound, &end2); if (post == NULL) return -1; |