[Privoxy-commits] [privoxy] 02/02: fix gcc maybe-uninitialized compiler warnings in acl_addr

User Git git at git.privoxy.org
Wed Aug 9 10:42:57 CEST 2023


This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository privoxy.

commit cda2a29c853e17c9ac714d17ac2f31434cb5d2f8
Author: Lee <ler762 at users.sourceforge.net>
AuthorDate: Wed Aug 9 04:42:15 2023 -0400

    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);
          |                   ^
---
 filters.c | 4 ++++
 1 file changed, 4 insertions(+)

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;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Privoxy-commits mailing list