From 27114db16e473136e10d1080457ce4a1dc0cf0c4 Mon Sep 17 00:00:00 2001 From: Arturo Bernal Date: Thu, 15 Oct 2026 05:55:02 +0200 Subject: [PATCH] core: Use ap_size_parameter_parse() for LimitXMLRequestBody LimitXMLRequestBody got its own apr_strtoff() parsing in #825, before ap_size_parameter_parse() was added in #829. Use the common helper like LimitRequestBody does. No change in the accepted values. Add LimitXMLRequestBody to the directives checked in test_012. --- server/core.c | 7 ++++--- test/modules/core/test_012_config_off_t.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/core.c b/server/core.c index a1a7fb52286..a6928ef916c 100644 --- a/server/core.c +++ b/server/core.c @@ -3921,12 +3921,13 @@ static const char *set_limit_xml_req_body(cmd_parms *cmd, void *conf_, core_dir_config *conf = conf_; apr_uint64_t max = AP_MAX_LIMIT_XML_BODY; apr_off_t limit; - char *errp; + apr_status_t rv; - if (APR_SUCCESS != apr_strtoff(&limit, arg, &errp, 10)) { + rv = ap_size_parameter_parse(arg, &limit); + if (rv == APR_ERANGE) { return "LimitXMLRequestBody argument is not parsable."; } - if (*errp || limit < 0) { + if (rv != APR_SUCCESS || limit < 0) { return "LimitXMLRequestBody requires a non-negative integer."; } diff --git a/test/modules/core/test_012_config_off_t.py b/test/modules/core/test_012_config_off_t.py index c7b3bd477ff..a21facdcf66 100644 --- a/test/modules/core/test_012_config_off_t.py +++ b/test/modules/core/test_012_config_off_t.py @@ -7,7 +7,7 @@ # size and time directives parsed with ap_size_parameter_parse(), which can # not be negative DIRECTIVES = [ - "LimitRequestBody", + "LimitRequestBody", "LimitXMLRequestBody", "ScriptLogLength", "ScriptLogBuffer", "CacheMinFileSize", "CacheMaxFileSize", "CacheReadSize", "CacheReadTime", "CacheSocacheMaxTime", "CacheSocacheMinTime", "CacheSocacheReadSize",