From: Douglas Bagnall Date: Wed, 3 Apr 2024 03:13:07 +0000 (+1300) Subject: s3:libsmb:namequery: use NUMERIC_CMP in addr_compare X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=3414a894ad6640fa8e282d650b1cc5319991545f;p=martins%2Fsamba-autobuild%2F.git s3:libsmb:namequery: use NUMERIC_CMP in addr_compare This one was OK, as the numbers are tightly bound, but there is no real reason not to do it safely. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625 Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index f787e516da0..8f6a9b51f81 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -34,6 +34,7 @@ #include "lib/gencache.h" #include "librpc/gen_ndr/dns.h" #include "lib/util/util_net.h" +#include "lib/util/tsort.h" #include "lib/util/string_wrappers.h" /* nmbd.c sets this to True. */ @@ -1183,7 +1184,7 @@ static int addr_compare(const struct sockaddr_storage *ss1, max_bits2 += 128; } } - return max_bits2 - max_bits1; + return NUMERIC_CMP(max_bits2, max_bits1); } /*