You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rainer Jung <ra...@kippdata.de> on 2026/10/02 12:35:57 UTC
Re: svn commit: r1938194 - in httpd/httpd/trunk: changes-entries include modules/http modules/mappers modules/metadata modules/proxy server test/modules/proxy test/unit
Hi Joe and all,
Am 14.09.26 um 13:05 schrieb jorton@apache.org:
> Author: jorton
> Date: Mon Sep 14 11:05:50 2026
> New Revision: 1938194
>
> Log:
> core: Add ap_cstr_stripws() to strip trailing whitespace from a
> NUL-terminated string in place, returning a pointer to the new
> terminating NUL.
>
> * include/httpd.h: Declare ap_cstr_stripws().
>
> * server/util.c (ap_cstr_stripws): Implement it, handling the
> empty-string case safely.
> (ap_getline): Use it; adjust the returned length and memmove size
> accordingly.
>
> * modules/http/byterange_filter.c, modules/mappers/mod_negotiation.c,
> modules/metadata/mod_cern_meta.c, modules/proxy/mod_proxy_hcheck.c,
> modules/proxy/mod_proxy_http.c, modules/proxy/mod_proxy_uwsgi.c,
> server/util_script.c: Replace open-coded trailing-whitespace
> stripping loops with ap_cstr_stripws(). This avoids the undefined
> behaviour of forming &value[strlen(value)-1], which points before
> the start of the string when the value is empty.
>
> * modules/metadata/mod_cern_meta.c, server/util_script.c: Use
> apr_pstrmemdup() with the returned end pointer rather than
> apr_pstrdup().
>
> * include/ap_mmn.h: Bump MMN minor.
>
> * test/unit/util.c: Add ap_cstr_stripws() unit tests.
>
> * test/modules/proxy/test_03_response.py,
> test/modules/proxy/test_05_uwsgi.py: Add tests for empty backend
> response header values.
These two tests seem to succeed when backported to 2.4.x. Not sure,
whether they only make sense to check the new trunk ap_cstr_stripws(),
or whether it would be useful if I merged just the two tests to 2.4.x?
Thanks and regards,
Rainer
Re: svn commit: r1938194 - in httpd/httpd/trunk: changes-entries include modules/http modules/mappers modules/metadata modules/proxy server test/modules/proxy test/unit
Posted by Joe Orton <jo...@apache.org>.
On Fri, Oct 02, 2026 at 02:35:57PM +0200, Rainer Jung wrote:
> Hi Joe and all,
>
> Am 14.09.26 um 13:05 schrieb jorton@apache.org:
> > Author: jorton
> > Date: Mon Sep 14 11:05:50 2026
> > New Revision: 1938194
> >
> > Log:
> > core: Add ap_cstr_stripws() to strip trailing whitespace from a
> > NUL-terminated string in place, returning a pointer to the new
> > terminating NUL.
...
> > * test/modules/proxy/test_03_response.py,
> > test/modules/proxy/test_05_uwsgi.py: Add tests for empty backend
> > response header values.
> These two tests seem to succeed when backported to 2.4.x. Not sure, whether
> they only make sense to check the new trunk ap_cstr_stripws(), or whether it
> would be useful if I merged just the two tests to 2.4.x?
Hi Rainer, sorry I missed this.
These are technically triggering undefined behaviour, but I'm not sure
if they trigger UBSAN or only some custom static analyser. It would be
good to backport the fixes at the same time IMO.
Regards, Joe