]> 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)
committerJule Anger <janger@samba.org>
Mon, 10 Jun 2024 13:25:16 +0000 (13:25 +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>
(cherry picked from commit 623adcf4aae00ac06e82d98a75ce4644890501e6)

source4/dsdb/samdb/ldb_modules/operational.c

index 8821765a703bb0f92ad9db4cdb715fb0aa631bad..8c8bfa89ddef1ad0469cc287707333bdec8959d1 100644 (file)
@@ -1073,7 +1073,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);
        }
 }