Index: apr-trunk/buckets/apr_brigade.c =================================================================== --- apr-trunk/buckets/apr_brigade.c (revision 1875770) +++ apr-trunk/buckets/apr_brigade.c (working copy) @@ -359,7 +359,9 @@ pos = memchr(str, APR_ASCII_LF, len); /* We found a match. */ if (pos != NULL) { - apr_bucket_split(e, pos - str + 1); + if ((pos - str + 1) < e->length) { + apr_bucket_split(e, pos - str + 1); + } APR_BUCKET_REMOVE(e); APR_BRIGADE_INSERT_TAIL(bbOut, e); return APR_SUCCESS;