Skip to content

core: Reject invalid values of LimitXMLRequestBody. - #825

Closed
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/httpd-69975-limit-xml-request-body
Closed

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/httpd-69975-limit-xml-request-body

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

set_limit_xml_req_body() used atol(), so "abc123" and "123abc" were accepted as 0 and 123, and overflows were silently clamped. Parse the whole argument with apr_strtoff() like LimitRequestBody, and reject values that do not fit in limit_xml_body or exceed AP_MAX_LIMIT_XML_BODY. BZ 69975.


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • [X ] New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • [X ] If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • [X ] Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

set_limit_xml_req_body() used atol(), so "abc123" and "123abc" were
accepted as 0 and 123, and overflows were silently clamped. Parse the
whole argument with apr_strtoff() like LimitRequestBody, and reject
values that do not fit in limit_xml_body or exceed AP_MAX_LIMIT_XML_BODY.
BZ 69975.
@arturobernalg
arturobernalg force-pushed the fix/httpd-69975-limit-xml-request-body branch from 38624d4 to 226d1f5 Compare October 10, 2026 15:02
@notroj

notroj commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

+1 though we really could do with having one function for turning config input into an apr_off_t, like ap_timeout_parameter_parse , there are a bunch of places this is done inconsistently likely.

@arturobernalg

Copy link
Copy Markdown
Member Author

Thanks. Agreed, a single helper to parse a config value into an apr_off_t would be better than what we have now. I checked the current callers, and several of them (the cache modules, mod_buffer, mod_auth_form, mod_dav_fs, mod_cgi) accept trailing characters, or have no checks at all. I'll look at that as a separate change, so this one can stay as it is.

arturobernalg added a commit to arturobernalg/httpd that referenced this pull request Oct 15, 2026
ap_size_parameter_parse() returned APR_ERANGE for a value without any
digits where the libc sets EINVAL when nothing is converted (FreeBSD,
musl), and APR_EINVAL with glibc. end == parameter tells portably that
nothing was converted, so check it before the apr_strtoff() status.
APR_EINVAL is for invalid syntax, APR_ERANGE stays for overflow and
underflow.

Use it for LimitXMLRequestBody too, which had its own apr_strtoff()
parsing from apache#825, so that it reports the same errors as
LimitRequestBody on every platform. No change in the accepted values.

Extend test_012 to check that LimitRequestBody reports invalid syntax
and range errors with their own messages, and to cover
LimitXMLRequestBody.
arturobernalg added a commit to arturobernalg/httpd that referenced this pull request Oct 15, 2026
ap_size_parameter_parse() returned APR_ERANGE for a value without any
digits where the libc sets EINVAL when nothing is converted (FreeBSD,
musl), and APR_EINVAL with glibc. end == parameter tells portably that
nothing was converted, so check it before the apr_strtoff() status.
APR_EINVAL is for invalid syntax, APR_ERANGE stays for overflow and
underflow.

Use it for LimitXMLRequestBody too, which had its own apr_strtoff()
parsing from apache#825, so that it reports the same errors as
LimitRequestBody on every platform. No change in the accepted values.

Extend test_012 to check that LimitRequestBody reports invalid syntax
and range errors with their own messages, and to cover
LimitXMLRequestBody.
asf-gitbox-commits pushed a commit that referenced this pull request Oct 16, 2026
ap_size_parameter_parse() returned APR_ERANGE for a value without any
digits where the libc sets EINVAL when nothing is converted (FreeBSD,
musl), and APR_EINVAL with glibc. end == parameter tells portably that
nothing was converted, so check it before the apr_strtoff() status.
APR_EINVAL is for invalid syntax, APR_ERANGE stays for overflow and
underflow.

Use it for LimitXMLRequestBody too, which had its own apr_strtoff()
parsing from #825, so that it reports the same errors as
LimitRequestBody on every platform. No change in the accepted values.

Extend test_012 to check that LimitRequestBody reports invalid syntax
and range errors with their own messages, and to cover
LimitXMLRequestBody.

GitHub: closes #848


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939163 13f79535-47bb-0310-9956-ffa450edef68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants