From: Ruediger Pluem Date: Thu, 2 Oct 2025 13:00:44 +0000 (+0000) Subject: Correctly parse Range headers with multiple ranges X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60ad836ff81839e22e508530522f0d4dbbe802cf;p=thirdparty%2Fapache%2Fhttpd.git Correctly parse Range headers with multiple ranges Correctly parse Range headers with multiple ranges that have whitespaces around the comma separating the ranges from each other by trimming the whitespace. PR: 69831 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1928901 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/changes-entries/pr69831.txt b/changes-entries/pr69831.txt new file mode 100644 index 0000000000..8e254faa59 --- /dev/null +++ b/changes-entries/pr69831.txt @@ -0,0 +1,3 @@ + *) http: Correctly parse Range headers with multiple ranges that have + whitespaces around the comma separating the ranges from each other. + PR 69831 [Ruediger Pluem] diff --git a/modules/http/byterange_filter.c b/modules/http/byterange_filter.c index 6fdc665887..e1c69b0ba7 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -136,9 +136,17 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength, } *indexes = apr_array_make(r->pool, ranges, sizeof(indexes_t)); while ((cur = ap_getword(r->pool, &range, ','))) { - char *dash; + char *dash, *end_cur; apr_off_t number, start, end; + /* Remove leading and trailing white spaces */ + while (apr_isspace(*cur)) + ++cur; + /* blast trailing whitespace */ + end_cur = &cur[strlen(cur)]; + while (--end_cur >= cur && apr_isspace(*end_cur)) + *end_cur = '\0'; + if (!*cur) break;