From: Lee Date: Wed, 9 Aug 2023 08:42:15 +0000 (-0400) Subject: fix gcc maybe-uninitialized compiler warnings in acl_addr X-Git-Url: http://www.privoxy.org/gitweb/-%22../user-manual/static/gitweb.js?a=commitdiff_plain;h=cda2a29c853e17c9ac714d17ac2f31434cb5d2f8;p=privoxy.git fix gcc maybe-uninitialized compiler warnings in acl_addr I can't tell if they're false positives or not, but compiling with no warnings is better than seeing this: filters.c: In function ‘acl_addr’: filters.c:465:31: warning: ‘addr_len’ may be used uninitialized in this function [-Wmaybe-uninitialized] 465 | for (i = 0; (i < addr_len) && masklength; i++) | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~ filters.c:454:18: warning: ‘mask_port’ may be used uninitialized in this function [-Wmaybe-uninitialized] 454 | *mask_port = 1; | ~~~~~~~~~~~^~~ filters.c:479:19: warning: ‘mask_data’ may be used uninitialized in this function [-Wmaybe-uninitialized] 479 | mask_data[i] = (uint8_t)~((1 << (8 - masklength)) - 1); | ^ --- diff --git a/filters.c b/filters.c index 86a1dfcb..9915bf5d 100644 --- a/filters.c +++ b/filters.c @@ -342,6 +342,10 @@ int acl_addr(const char *aspec, struct access_control_addr *aca) char *p; char *acl_spec = NULL; + mask_data = NULL; + mask_port = NULL; + addr_len = 0; + #ifdef HAVE_RFC2553 /* XXX: Depend on ai_family */ masklength = 128;