platform: fix undefined behavior for pointer comparison in ip4_addr_subnets_is_plain_address()

Fixes: 2f68a50041 ('platform: fix the order of addition of primary and secondary IPv4 addresses')
This commit is contained in:
Thomas Haller 2022-03-31 10:57:25 +02:00
parent cedaa191d4
commit 40f22e69c8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -3762,8 +3762,8 @@ clear_and_next:
static gboolean
ip4_addr_subnets_is_plain_address(const GPtrArray *addresses, gconstpointer needle)
{
return needle >= (gconstpointer) &addresses->pdata[0]
&& needle < (gconstpointer) &addresses->pdata[addresses->len];
return nm_ptr_to_uintptr(needle) >= nm_ptr_to_uintptr(&addresses->pdata[0])
&& nm_ptr_to_uintptr(needle) < nm_ptr_to_uintptr(&addresses->pdata[addresses->len]);
}
static const NMPObject **