aboutsummaryrefslograw-logtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/aaa/mod_auth_digest.c[diff] [file]30
-rw-r--r--modules/filters/mod_substitute.c[diff] [file]29
2 files changed, 8 insertions, 51 deletions
diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c
index 9188c7252c..3c8b1a9b0d 100644
--- a/modules/aaa/mod_auth_digest.c
+++ b/modules/aaa/mod_auth_digest.c
@@ -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);
- }
- 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++;
+ rv = ap_size_parameter_parse(size_str, &size);
+ if (rv == APR_ERANGE) {
+ return "AuthDigestShmemSize value is too large";
}
- if (*endptr != '\0') {
+ if (rv != APR_SUCCESS || size < 0) {
return apr_pstrcat(cmd->pool, "Invalid size in AuthDigestShmemSize: ",
size_str, NULL);
}
diff --git a/modules/filters/mod_substitute.c b/modules/filters/mod_substitute.c
index c78992c483..6cb9fa06ba 100644
--- a/modules/filters/mod_substitute.c
+++ b/modules/filters/mod_substitute.c
@@ -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 "
This site is maintained by Jamie Landeg-Jones <jamie@catflap.org>, and is not an official FreeBSD project, nor is it endorsed by the FreeBSD team.