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

User Git git at git.privoxy.org
Wed Aug 9 10:42:56 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 b1fbecac2b4058d2a3db3c889ff75012940bef8f
Author: Lee <ler762 at users.sourceforge.net>
AuthorDate: Wed Aug 9 04:34:55 2023 -0400

    fix gcc maybe-uninitialized compiler warnings in match_sockaddr
    
    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 ‘match_sockaddr’:
    filters.c:205:42: warning: ‘address_port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      205 |    if (*netmask_port && *network_port != *address_port)
          |                                          ^~~~~~~~~~~~~
    filters.c:214:24: warning: ‘address_addr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      214 |           (address_addr[i] & netmask_addr[i]))
          |            ~~~~~~~~~~~~^~~
    filters.c:205:8: warning: ‘netmask_port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      205 |    if (*netmask_port && *network_port != *address_port)
          |        ^~~~~~~~~~~~~
    filters.c:200:20: warning: ‘netmask_addr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      200 |       netmask_addr += 12;
          |                    ^~
    filters.c:205:25: warning: ‘network_port’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      205 |    if (*netmask_port && *network_port != *address_port)
          |                         ^~~~~~~~~~~~~
    filters.c:172:17: warning: ‘addr_len’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      172 |    unsigned int addr_len;
          |                 ^~~~~~~~
---
 filters.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/filters.c b/filters.c
index 35c8476f..86a1dfcb 100644
--- a/filters.c
+++ b/filters.c
@@ -173,6 +173,14 @@ static int match_sockaddr(const struct sockaddr_storage *network,
    in_port_t *network_port, *netmask_port, *address_port;
    int i;
 
+   network_addr = NULL;
+   netmask_addr = NULL;
+   address_addr = NULL;
+   addr_len = 0;
+   network_port = NULL;
+   netmask_port = NULL;
+   address_port = NULL;
+
    if (network->ss_family != netmask->ss_family)
    {
       /* This should never happen */

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


More information about the Privoxy-commits mailing list