diff -r bdce415f3d2e src/apache-2/apache_multipart_buffer.c
--- a/src/apache-2/apache_multipart_buffer.c	Sun Nov 18 01:52:59 2007 +0200
+++ b/src/apache-2/apache_multipart_buffer.c	Mon Nov 26 15:04:34 2007 +0200
@@ -40,9 +40,9 @@ void* my_memstr(char* haystack, int hays
     while( (ptr = memchr(ptr, needle[0], len)) ) {
 	/* calculate length after match */
 	len = haystacklen - (ptr - (char *)haystack);
-
+	 ;
 	/* done if matches up to capacity of buffer */
-	if(memcmp(needle, ptr, needlen < len ? needlen : len) == 0 &&
+	if(memcmp(needle, ptr, needlen) == 0 &&
 	   (partial || len >= needlen))
 	    break;
 
@@ -190,7 +190,7 @@ multipart_buffer *multipart_buffer_new(c
     self->bufsize = minsize;
     self->request_length = length;
     self->boundary = (char*) apr_pstrcat(r->pool, "--", boundary, NULL);
-    self->boundary_next = (char*) apr_pstrcat(r->pool, "\n", self->boundary, NULL);
+    self->boundary_next = (char*) apr_pstrcat(r->pool, "\n", self->boundary+2, NULL);
     self->buf_begin = self->buffer;
     self->bytes_in_buffer = 0;
 
@@ -254,13 +254,15 @@ int multipart_buffer_read(multipart_buff
 
     /* look for a potential boundary match, only read data up to that point */
     if( (bound = my_memstr(self->buf_begin, self->bytes_in_buffer,
-			   self->boundary_next, 1)) )
-	max = bound - self->buf_begin;
-    else
+			   self->boundary_next, 1)) ) {
+	max = bound - self->buf_begin - 1 ;
+	self->bytes_in_buffer=max+1;
+     } else {
 	max = self->bytes_in_buffer;
-
+     }
     /* maximum number of bytes we are reading */
     len = max < bytes-1 ? max : bytes-1;
+
 
     /* if we read any data... */
     if(len > 0) {
