aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_geo_module.c
diff options
context:
space:
mode:
authorPiotr Sikora <piotr@aviatrix.com>2024-03-14 18:37:20 +0400
committerPiotr Sikora <piotr@aviatrix.com>2024-03-14 18:37:20 +0400
commitd3d64cacb3ce96477d354fe17d3b5c6e348f933a (patch)
tree014471753874a52b6fea50984a3e98f4fe469ee2 /src/http/modules/ngx_http_geo_module.c
parent5e79d98a59b6d094145200976077aa7ca34a84d0 (diff)
downloadnginx-d3d64cacb3ce96477d354fe17d3b5c6e348f933a.tar.gz
nginx-d3d64cacb3ce96477d354fe17d3b5c6e348f933a.zip
Geo: fixed uninitialized memory access.
While copying ngx_http_variable_value_t structures to geo binary base in ngx_http_geo_copy_values(), and similarly in the stream module, uninitialized parts of these structures are copied as well. These include the "escape" field and possible holes. Calculating crc32 of this data triggers uninitialized memory access. Found with MemorySanitizer. Signed-off-by: Piotr Sikora <piotr@aviatrix.com>
Diffstat (limited to 'src/http/modules/ngx_http_geo_module.c')
-rw-r--r--src/http/modules/ngx_http_geo_module.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index ef4e9b84a..8496b651a 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -1259,7 +1259,7 @@ ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
return gvvn->value;
}
- val = ngx_palloc(ctx->pool, sizeof(ngx_http_variable_value_t));
+ val = ngx_pcalloc(ctx->pool, sizeof(ngx_http_variable_value_t));
if (val == NULL) {
return NULL;
}
@@ -1271,8 +1271,6 @@ ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx,
}
val->valid = 1;
- val->no_cacheable = 0;
- val->not_found = 0;
gvvn = ngx_palloc(ctx->temp_pool,
sizeof(ngx_http_geo_variable_value_node_t));