commit 224721e7f03f2fee72d36f664444543d5f21bc29
parent 2135a4f84555cff27a2aedc000a6fa8d710c831a
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 18 Oct 2021 10:21:47 -0500
netconfig: Make sure gw is not NULL
strcmp behavior is undefined if one of the parameters is NULL.
Server-id is a mandatory value and cannot be NULL. Gateway can be NULL
in DHCP, so check that explicitly.
Reported-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/netconfig.c b/src/netconfig.c
@@ -594,7 +594,7 @@ static void netconfig_gateway_to_arp(struct netconfig *netconfig)
gw = l_dhcp_lease_get_gateway(lease);
server_mac = l_dhcp_lease_get_server_mac(lease);
- if (strcmp(server_id, gw) || !server_mac)
+ if (!gw || strcmp(server_id, gw) || !server_mac)
return;
l_debug("Gateway MAC is known, setting into ARP cache");