]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:wins: winsdb_addr_sort_list() uses NUMERIC_CMP()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 4 Apr 2024 01:16:21 +0000 (14:16 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Apr 2024 22:56:33 +0000 (22:56 +0000)
expire_time is time_t, which is at least int-sized, so overflow is
possible (if this code ever runs).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/nbt_server/wins/winsdb.c

index eb554fc5bd3449d76b54547e8c5bc59bac1f4549..7df40c331352e2647e5ae6c7fbe234761a572e91 100644 (file)
@@ -350,7 +350,7 @@ static int winsdb_addr_sort_list (struct winsdb_addr **p1, struct winsdb_addr **
         * then the replica addresses with the newest to the oldest address
         */
        if (a2->expire_time != a1->expire_time) {
-               return a2->expire_time - a1->expire_time;
+               return NUMERIC_CMP(a2->expire_time, a1->expire_time);
        }
 
        if (strcmp(a2->wins_owner, h->local_owner) == 0) {