From 9f8bde9048d5bb81ad39e8779cc72633b0e2597b Mon Sep 17 00:00:00 2001 From: Rahul Rajesh Date: Thu, 7 May 2026 15:57:30 -0400 Subject: [PATCH] manager: fix underflow in compare_device_remove_order Use `int` instead of `uint` for scores becuase we want to result to have negative interger values as well. `uint` would cause integer underflow with unsigned arithmetic if a_score is greater than b_score. --- src/core/nm-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index ada26de1bd..1dfcc12719 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -8161,8 +8161,8 @@ compare_device_remove_order(const CList *a, const CList *b, const void *user_dat /* priority: software AND dhcp first, then dhcp only * then everything else,*/ - uint a_score = a_has_dhcp ? (a_is_software ? 2 : 1) : 0; - uint b_score = b_has_dhcp ? (b_is_software ? 2 : 1) : 0; + int a_score = a_has_dhcp ? (a_is_software ? 2 : 1) : 0; + int b_score = b_has_dhcp ? (b_is_software ? 2 : 1) : 0; return b_score - a_score; }