]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:util:net_registry: registry_value_cmp() uses NUMERIC_CMP()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 4 Apr 2024 01:25:54 +0000 (14:25 +1300)
committerJule Anger <janger@samba.org>
Mon, 10 Jun 2024 13:25:17 +0000 (13:25 +0000)
v->type is an int-sized enum, so overflow might be possible if it could
be arbitrarily set.

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 5e99262aaf5fc6601f3859c8b060b680b11bf6ea)

source3/utils/net_registry.c

index 5d1314ec37a5ebe4b4ba065d29afd8bf42e24f5f..b47a8ff88b197dc9665e399087260e05f4f2273b 100644 (file)
@@ -1146,7 +1146,7 @@ static int registry_value_cmp(
        if (v1->type == v2->type) {
                return data_blob_cmp(&v1->data, &v2->data);
        }
-       return v1->type - v2->type;
+       return NUMERIC_CMP(v1->type, v2->type);
 }
 
 static WERROR precheck_create_val(struct precheck_ctx *ctx,