[PATCH] Geo: fix uninitialized memory access

Piotr Sikora piotr at aviatrix.com
Wed Feb 28 01:21:40 UTC 2024


# HG changeset patch
# User Piotr Sikora <piotr at aviatrix.com>
# Date 1708977621 0
#      Mon Feb 26 20:00:21 2024 +0000
# Branch patch005
# Node ID fe6f8a72d42970df176ea53f4f0aea16947ba5b8
# Parent  52936793ac076072c3544aa4e27f973d2f8fecda
Geo: fix uninitialized memory access.

Found with MemorySanitizer.

Signed-off-by: Piotr Sikora <piotr at aviatrix.com>

diff -r 52936793ac07 -r fe6f8a72d429 src/http/modules/ngx_http_geo_module.c
--- a/src/http/modules/ngx_http_geo_module.c	Mon Feb 26 20:00:19 2024 +0000
+++ b/src/http/modules/ngx_http_geo_module.c	Mon Feb 26 20:00:21 2024 +0000
@@ -1259,7 +1259,7 @@
         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;
     }
diff -r 52936793ac07 -r fe6f8a72d429 src/stream/ngx_stream_geo_module.c
--- a/src/stream/ngx_stream_geo_module.c	Mon Feb 26 20:00:19 2024 +0000
+++ b/src/stream/ngx_stream_geo_module.c	Mon Feb 26 20:00:21 2024 +0000
@@ -1209,7 +1209,7 @@
         return gvvn->value;
     }
 
-    val = ngx_palloc(ctx->pool, sizeof(ngx_stream_variable_value_t));
+    val = ngx_pcalloc(ctx->pool, sizeof(ngx_stream_variable_value_t));
     if (val == NULL) {
         return NULL;
     }


More information about the nginx-devel mailing list