Valgrind reporting issue in connection->addr_text

bhagavathula nginx-forum at
Mon May 6 18:08:58 UTC 2019


When running Valgrind on our NGINX module for errors, found the following
==49784== Conditional jump or move depends on uninitialised value(s)
==49784==    at 0x4C32D08: strlen (in
==49784==    by 0x6C3A328: apr_pstrdup (in
==49784==    by 0x6C3DB3D: apr_table_add (in
==49784==    by 0x611CC82: get_request_properties
==49784==    by 0x611CE30: get_new_token (ta_ngx_http_module.c:351)
==49784==    by 0x611CF55: get_token_helper (ta_ngx_http_module.c:374)
==49784==    by 0x611D4BC: ta_post_read_request_helper
==49784==    by 0x611D750: ta_post_read_request (ta_ngx_http_module.c:920)
==49784==    by 0x1553E6: ngx_http_core_access_phase
==49784==    by 0x150A34: ngx_http_core_run_phases
==49784==    by 0x150ADA: ngx_http_handler (ngx_http_core_module.c:841)
==49784==    by 0x1594B0: ngx_http_process_request
==49784==  Uninitialised value was created by a heap allocation
==49784==    at 0x4C31E76: memalign (in
==49784==    by 0x4C31F91: posix_memalign (in
==49784==    by 0x14611F: ngx_memalign (ngx_alloc.c:57)
==49784==    by 0x122D09: ngx_create_pool (ngx_palloc.c:23)
==49784==    by 0x142CD6: ngx_event_accept (ngx_event_accept.c:161)
==49784==    by 0x14D313: ngx_epoll_process_events (ngx_epoll_module.c:902)
==49784==    by 0x14218D: ngx_process_events_and_timers (ngx_event.c:242)
==49784==    by 0x14C2A3: ngx_single_process_cycle
==49784==    by 0x1214E4: main (nginx.c:379)

The code that is causing the error is as follows:
const char *ip	=(char *) (r->connection->addr_text).data;
apr_table_add(request_table, (char *) TA_PROP_CLIENT_ADDR, ip);

When printing the ip which is supposed to be "" (localhost), but at
times some garbage value is appended like: at 1\u000b0\t\u0006\u0003xW�\u0005

I am not able to understand why addr_text contains garbage value, Can
someone pls help me.

Posted at Nginx Forum:,284065,284065#msg-284065

More information about the nginx mailing list