Skip to content

Commit

Permalink
Fix -Werror=maybe-uninitialized on GCC 12
Browse files Browse the repository at this point in the history
The following error is happening on Ubuntu Lunar (development
version):

In function ‘ip_islocalhost’,
    inlined from ‘gvm_routethrough’ at ./base/networking.c:1032:11:
./base/networking.c:863:22: error: ‘addr6.__in6_u.__u6_addr32[3]’ may be used uninitialized [-Werror=maybe-uninitialized]
./base/networking.c: In function ‘gvm_routethrough’:
./base/networking.c:790:19: note: ‘addr6.__in6_u.__u6_addr32[3]’ was declared here

This commit fixes it by always initializing "addr6" with
"IN6ADDR_ANY_INIT".

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
  • Loading branch information
Sergio Durigan Junior committed Jan 5, 2023
1 parent 257d004 commit dd95e59
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/networking.c
Expand Up @@ -787,7 +787,7 @@ ip_islocalhost (struct sockaddr_storage *storage)
{
struct in_addr addr;
struct in_addr *addr_p;
struct in6_addr addr6;
struct in6_addr addr6 = IN6ADDR_ANY_INIT;
struct in6_addr *addr6_p;
struct sockaddr_in *sin_p;
struct sockaddr_in6 *sin6_p;
Expand Down

0 comments on commit dd95e59

Please sign in to comment.