From cda2a29c853e17c9ac714d17ac2f31434cb5d2f8 Mon Sep 17 00:00:00 2001
From: Lee <ler762@users.sourceforge.net>
Date: Wed, 9 Aug 2023 04:42:15 -0400
Subject: [PATCH] fix gcc maybe-uninitialized compiler warnings in acl_addr
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

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;
-- 
2.49.0