diff options
author | Joe Orton <jorton@apache.org> | 2020-02-17 11:11:56 +0100 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2020-02-17 11:11:56 +0100 |
commit | 2517583a449cc109733e443f8994bf7782687bdc (patch) | |
tree | d5374818d5acb9bfdf6cc0b1b1e1f7e71f67780a /modules/aaa | |
parent | * modules/http/http_filters.c (parse_chunk_size): Reduce by four the (diff) | |
download | apache2-2517583a449cc109733e443f8994bf7782687bdc.tar.xz apache2-2517583a449cc109733e443f8994bf7782687bdc.zip |
Define ap_method_mask_t (typedef for apr_uint64_t) and use for method
bitmasks rather than apr_int64_t. Fixes UBSan errors shifting to the
top bit of a signed integer.
* include/httpd.h: Add ap_method_mask_t, use it for AP_METHOD_BIT.
(struct ap_method_mask_t): Likewise for method_mask field.
(struct request_rec): Likewise for allowed field.
* include/http_config.h (struct cmd_parms): Likewise for limited field.
* include/ap_mmn.h: Bump MMN major.
* modules/*/*.c: Adjust all method masks to use ap_method_mask_t.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874114 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/aaa')
-rw-r--r-- | modules/aaa/mod_access_compat.c | 4 | ||||
-rw-r--r-- | modules/aaa/mod_allowmethods.c | 2 | ||||
-rw-r--r-- | modules/aaa/mod_authz_core.c | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/modules/aaa/mod_access_compat.c b/modules/aaa/mod_access_compat.c index e9f1abe483..866e208ff3 100644 --- a/modules/aaa/mod_access_compat.c +++ b/modules/aaa/mod_access_compat.c @@ -53,7 +53,7 @@ enum allowdeny_type { }; typedef struct { - apr_int64_t limited; + ap_method_mask_t limited; union { char *from; apr_ipsubnet_t *ip; @@ -243,7 +243,7 @@ static int find_allowdeny(request_rec *r, apr_array_header_t *a, int method) { allowdeny *ap = (allowdeny *) a->elts; - apr_int64_t mmask = (AP_METHOD_BIT << method); + ap_method_mask_t mmask = (AP_METHOD_BIT << method); int i; int gothost = 0; const char *remotehost = NULL; diff --git a/modules/aaa/mod_allowmethods.c b/modules/aaa/mod_allowmethods.c index dd411969e0..3062efd323 100644 --- a/modules/aaa/mod_allowmethods.c +++ b/modules/aaa/mod_allowmethods.c @@ -45,7 +45,7 @@ typedef struct am_conf_t { int allowed_set; - apr_int64_t allowed; + ap_method_mask_t allowed; } am_conf_t; module AP_MODULE_DECLARE_DATA allowmethods_module; diff --git a/modules/aaa/mod_authz_core.c b/modules/aaa/mod_authz_core.c index 40e5fe1414..53c2663917 100644 --- a/modules/aaa/mod_authz_core.c +++ b/modules/aaa/mod_authz_core.c @@ -70,7 +70,7 @@ struct authz_section_conf { const char *provider_args; const void *provider_parsed_args; const authz_provider *provider; - apr_int64_t limited; + ap_method_mask_t limited; authz_logic_op op; int negate; /** true if this is not a real container but produced by AuthMerging; @@ -478,7 +478,7 @@ static const char *add_authz_section(cmd_parms *cmd, void *mconfig, authz_section_conf *old_section = conf->section; authz_section_conf *section; int old_overrides = cmd->override; - apr_int64_t old_limited = cmd->limited; + ap_method_mask_t old_limited = cmd->limited; const char *errmsg; if (endp == NULL) { @@ -1016,7 +1016,7 @@ static authz_status method_check_authorization(request_rec *r, const char *require_line, const void *parsed_require_line) { - const apr_int64_t *allowed = parsed_require_line; + const ap_method_mask_t *allowed = parsed_require_line; if (*allowed & (AP_METHOD_BIT << r->method_number)) return AUTHZ_GRANTED; else @@ -1027,7 +1027,7 @@ static const char *method_parse_config(cmd_parms *cmd, const char *require_line, const void **parsed_require_line) { const char *w, *t; - apr_int64_t *allowed = apr_pcalloc(cmd->pool, sizeof(apr_int64_t)); + ap_method_mask_t *allowed = apr_pcalloc(cmd->pool, sizeof *allowed); t = require_line; |