From: Ivan Zhakov Date: Mon, 29 Jun 2026 10:10:40 +0000 (+0000) Subject: Cast cmd_parms.info to correct type (apr_size_t). X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c0567d67536b00a082f1139e16b8b5961933271;p=thirdparty%2Fapache%2Fhttpd.git Cast cmd_parms.info to correct type (apr_size_t). APR_OFFSETOF() returns apr_size_t and functions like ap_set_string_slot() stores it in cmd_parms.info. * modules/filters/mod_sed.c (sed_add_expr): * modules/http/mod_mime.c (attrib_info): Use apr_size_t instead of int for offset field. (add_extension_info, remove_extension_info): Cast cmd_parms.info to apr_size instead of int. * server/config.c (ap_set_string_slot, ap_set_int_slot, ap_set_string_slot_lower, ap_set_flag_slot, ap_set_flag_slot_char, ap_set_file_slot): Cast cmd_parms.info to apr_size instead of int. * server/core.c (set_server_string_slot): Cast cmd_parms.info to apr_size instead of int. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935705 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_sed.c b/modules/filters/mod_sed.c index 12cb04a20f..193a41254f 100644 --- a/modules/filters/mod_sed.c +++ b/modules/filters/mod_sed.c @@ -489,7 +489,7 @@ static apr_status_t sed_request_filter(ap_filter_t *f, static const char *sed_add_expr(cmd_parms *cmd, void *cfg, const char *arg) { - int offset = (int) (long) cmd->info; + apr_size_t offset = (apr_size_t) cmd->info; sed_expr_config *sed_cfg = (sed_expr_config *) (((char *) cfg) + offset); if (compile_sed_expr(sed_cfg, cmd, arg) != APR_SUCCESS) { diff --git a/modules/http/mod_mime.c b/modules/http/mod_mime.c index a710c4ad0f..e00d0f7327 100644 --- a/modules/http/mod_mime.c +++ b/modules/http/mod_mime.c @@ -53,7 +53,7 @@ typedef struct attrib_info { char *name; - int offset; + apr_size_t offset; } attrib_info; /* Information to which an extension can be mapped @@ -267,7 +267,7 @@ static const char *add_extension_info(cmd_parms *cmd, void *m_, { mime_dir_config *m=m_; extension_info *exinfo; - int offset = (int) (long) cmd->info; + apr_size_t offset = (apr_size_t) cmd->info; char *key = apr_pstrdup(cmd->temp_pool, ext); char *value = apr_pstrdup(cmd->pool, value_); ap_str_tolower(value); @@ -322,7 +322,7 @@ static const char *remove_extension_info(cmd_parms *cmd, void *m_, suffix = (attrib_info *)apr_array_push(m->remove_mappings); suffix->name = apr_pstrdup(cmd->pool, ext); ap_str_tolower(suffix->name); - suffix->offset = (int) (long) cmd->info; + suffix->offset = (apr_size_t) cmd->info; return NULL; } diff --git a/server/config.c b/server/config.c index 712bcab3db..c294fed56a 100644 --- a/server/config.c +++ b/server/config.c @@ -1472,7 +1472,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg) { - int offset = (int)(long)cmd->info; + int offset = (int)(apr_uintptr_t)cmd->info; *(const char **)((char *)struct_ptr + offset) = arg; @@ -1485,7 +1485,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd, { char *endptr; char *error_str = NULL; - int offset = (int)(long)cmd->info; + apr_size_t offset = (apr_size_t)cmd->info; *(int *)((char*)struct_ptr + offset) = strtol(arg, &endptr, 10); @@ -1503,7 +1503,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, const char *arg_) { char *arg = apr_pstrdup(cmd->pool,arg_); - int offset = (int)(long)cmd->info; + apr_size_t offset = (apr_size_t)cmd->info; ap_str_tolower(arg); *(char **)((char *)struct_ptr + offset) = arg; @@ -1514,7 +1514,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr_v, int arg) { - int offset = (int)(long)cmd->info; + apr_size_t offset = (apr_size_t)cmd->info; char *struct_ptr = (char *)struct_ptr_v; *(int *)(struct_ptr + offset) = arg ? 1 : 0; @@ -1525,7 +1525,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, AP_DECLARE_NONSTD(const char *) ap_set_flag_slot_char(cmd_parms *cmd, void *struct_ptr_v, int arg) { - int offset = (int)(long)cmd->info; + apr_size_t offset = (apr_size_t)cmd->info; char *struct_ptr = (char *)struct_ptr_v; *(struct_ptr + offset) = arg ? 1 : 0; @@ -1542,7 +1542,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, void *struct_pt * so the server can be moved or mirrored with less pain. */ const char *path; - int offset = (int)(long)cmd->info; + int offset = (int)(apr_uintptr_t)cmd->info; path = ap_server_root_relative(cmd->pool, arg); diff --git a/server/core.c b/server/core.c index 315d6b5bac..b060ce5f64 100644 --- a/server/core.c +++ b/server/core.c @@ -3208,7 +3208,7 @@ static const char *set_server_string_slot(cmd_parms *cmd, void *dummy, { /* This one's pretty generic... */ - int offset = (int)(long)cmd->info; + apr_size_t offset = (apr_size_t)cmd->info; char *struct_ptr = (char *)cmd->server; const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_CONTEXT);