From 40f22e69c8c03fbbe40f3ba701c3540470f49dfe Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 31 Mar 2022 10:57:25 +0200 Subject: [PATCH] platform: fix undefined behavior for pointer comparison in ip4_addr_subnets_is_plain_address() Fixes: 2f68a5004153 ('platform: fix the order of addition of primary and secondary IPv4 addresses') --- src/libnm-platform/nm-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index e67a37a746..af9e2bbf9f 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -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 **