From 898686466624e8e897530dc1451c96ebf684cb7e Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Thu, 8 Feb 2024 16:12:05 +0000 Subject: [PATCH] Missed in r1915658: * buckets/apr_brigade.c (apr_brigade_split_line): After finding an LF, only split the bucket if the LF is not the last character in the data. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1915661 13f79535-47bb-0310-9956-ffa450edef68 --- buckets/apr_brigade.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buckets/apr_brigade.c b/buckets/apr_brigade.c index 2ef530b907..79611b6367 100644 --- a/buckets/apr_brigade.c +++ b/buckets/apr_brigade.c @@ -359,7 +359,10 @@ APR_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut, pos = memchr(str, APR_ASCII_LF, len); /* We found a match. */ if (pos != NULL) { - apr_bucket_split(e, pos - str + 1); + /* Split if the LF is not the last character in the bucket. */ + if ((pos - str + 1) < len) { + apr_bucket_split(e, pos - str + 1); + } APR_BUCKET_REMOVE(e); APR_BRIGADE_INSERT_TAIL(bbOut, e); return APR_SUCCESS;