1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00

* modules/aaa/mod_auth_digest.c (set_shmem_size),

modules/filters/mod_substitute.c (set_max_line_length): Use
  ap_size_parameter_parse().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub: closes #851


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joe Orton
2026-10-20 19:29:54 +00:00
parent 973155ccd4
commit aa1e6c0d49
2 changed files with 8 additions and 51 deletions

View File

@@ -555,35 +555,15 @@ static const char *set_uri_list(cmd_parms *cmd, void *config, const char *uri)
static const char *set_shmem_size(cmd_parms *cmd, void *config,
const char *size_str)
{
char *endptr;
apr_off_t size;
apr_size_t min;
apr_status_t rv;
if (apr_strtoff(&size, size_str, &endptr, 10) != APR_SUCCESS || size < 0) {
return apr_pstrcat(cmd->pool, "Invalid size in AuthDigestShmemSize: ",
size_str, NULL);
rv = ap_size_parameter_parse(size_str, &size);
if (rv == APR_ERANGE) {
return "AuthDigestShmemSize value is too large";
}
if (*endptr == 'k' || *endptr == 'K') {
if (size > APR_INT64_MAX / 1024) {
return "AuthDigestShmemSize value is too large";
}
size *= 1024;
endptr++;
}
else if (*endptr == 'm' || *endptr == 'M') {
if (size > APR_INT64_MAX / (1024 * 1024)) {
return "AuthDigestShmemSize value is too large";
}
size *= 1024 * 1024;
endptr++;
}
else if (*endptr == 'b' || *endptr == 'B') {
endptr++;
}
while (apr_isspace(*endptr)) {
endptr++;
}
if (*endptr != '\0') {
if (rv != APR_SUCCESS || size < 0) {
return apr_pstrcat(cmd->pool, "Invalid size in AuthDigestShmemSize: ",
size_str, NULL);
}

View File

@@ -773,40 +773,17 @@ static const char *set_pattern(cmd_parms *cmd, void *cfg, const char *line)
return NULL;
}
#define KBYTE 1024
#define MBYTE 1048576
#define GBYTE 1073741824
static const char *set_max_line_length(cmd_parms *cmd, void *cfg, const char *arg)
{
subst_dir_conf *dcfg = (subst_dir_conf *)cfg;
apr_off_t max;
char *end;
apr_status_t rv;
rv = apr_strtoff(&max, arg, &end, 10);
if (rv == APR_SUCCESS) {
if ((*end == 'K' || *end == 'k') && !end[1]) {
if (max > APR_INT64_MAX / KBYTE)
return "SubstituteMaxLineLength value too large";
max *= KBYTE;
}
else if ((*end == 'M' || *end == 'm') && !end[1]) {
if (max > APR_INT64_MAX / MBYTE)
return "SubstituteMaxLineLength value too large";
max *= MBYTE;
}
else if ((*end == 'G' || *end == 'g') && !end[1]) {
if (max > APR_INT64_MAX / GBYTE)
return "SubstituteMaxLineLength value too large";
max *= GBYTE;
}
else if (*end && /* neither empty nor [Bb] */
((*end != 'B' && *end != 'b') || end[1])) {
rv = APR_EGENERAL;
}
rv = ap_size_parameter_parse(arg, &max);
if (rv == APR_ERANGE) {
return "SubstituteMaxLineLength value too large";
}
if (rv != APR_SUCCESS || max < 0)
{
return "SubstituteMaxLineLength must be a non-negative integer optionally "