From 68ff4327aca2b58d6838f91d1a55a3534b66093c Mon Sep 17 00:00:00 2001 From: Brian Neradt Date: Thu, 13 Jan 2022 16:23:04 +0000 Subject: [PATCH] LogFilter: fix NULL termination check gcc-12 generated the following warning: proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)': proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address] 477 | if (new_param && (new_param + 1)) { | ~~~~~~~~~~~^~~~ That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param is NULL because 1 will be added to it. The intention was to check for the string's null terminator at the offset, which is done via a dereference. --- proxy/logging/LogFilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/logging/LogFilter.h b/proxy/logging/LogFilter.h index 083dc08e6f0..749c044e5ac 100644 --- a/proxy/logging/LogFilter.h +++ b/proxy/logging/LogFilter.h @@ -474,7 +474,7 @@ wipeField(char **field, char *pattern, const char *uppercase_field) // search new param again const char *new_param = strchr(lookup_query_param + field_pos, '&'); - if (new_param && (new_param + 1)) { + if (new_param && *(new_param + 1)) { pattern_in_param_name = findPatternFromParamName(new_param + 1, pattern); } else { break;