3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

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>
This commit is contained in:
Denis Kenzior 2021-10-18 10:21:47 -05:00
parent 2135a4f845
commit 224721e7f0

View File

@ -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");