commit 094537efc62c5a265d96820c8b316e87dd9f7217
parent 772aa687d704760cc0c32f00fea9ac0204964682
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 4 Jun 2021 13:53:31 -0500
netconfig: Use inet_ntop instead of inet_ntoa
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
@@ -625,8 +625,8 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
{
L_AUTO_FREE_VAR(char *, gateway) = NULL;
struct in_addr in_addr;
- char *network;
char ip[INET_ADDRSTRLEN];
+ char network[INET_ADDRSTRLEN];
unsigned int prefix_len =
l_rtnl_address_get_prefix_length(netconfig->v4_address);
@@ -637,8 +637,7 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
in_addr.s_addr = in_addr.s_addr &
htonl(0xFFFFFFFFLU << (32 - prefix_len));
- network = inet_ntoa(in_addr);
- if (!network)
+ if (!inet_ntop(AF_INET, &in_addr, network, INET_ADDRSTRLEN))
return false;
if (!l_rtnl_route4_add_connected(rtnl, netconfig->ifindex,