]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:dsdb:mod:operational: use NUMERIC_CMP in pso_compare
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 2 Apr 2024 23:55:27 +0000 (12:55 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Apr 2024 22:56:33 +0000 (22:56 +0000)
prec_{1,2} are uint32_t, and if one is not set we are defaulting to
0xffffffff (a.k.a UINT32_MAX), so an overflow when cast to int seems
extremely likely.

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/dsdb/samdb/ldb_modules/operational.c

index b4b286b0267f8ebcae517521edabb6a2ab5277d2..2eb349f3e82351359f1673360e69203cb5c64ea7 100644 (file)
@@ -1071,7 +1071,7 @@ static int pso_compare(struct ldb_message **m1, struct ldb_message **m2)
 
                return ndr_guid_compare(&guid1, &guid2);
        } else {
-               return prec1 - prec2;
+               return NUMERIC_CMP(prec1, prec2);
        }
 }