]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
util:charset:codepoints: condepoint_cmpi uses NUMERIC_CMP()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 3 Apr 2024 02:53:29 +0000 (15:53 +1300)
committerJule Anger <janger@samba.org>
Mon, 10 Jun 2024 13:25:16 +0000 (13:25 +0000)
If these are truly unicode codepoints (< ~2m) there is no overflow,
but the type is defined as uint32_t.

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 675fdeee3d6570fdf5a055890dc3386a8db5fd88)

lib/util/charset/codepoints.c

index c39ed4a8436d3ac8cc62f178ef149b61bd7447b1..b5220763d40e85fdddc21fb1a7b3f600e96878d8 100644 (file)
@@ -26,6 +26,7 @@
 #include "dynconfig/dynconfig.h"
 #include "lib/util/debug.h"
 #include "lib/util/byteorder.h"
+#include "lib/util/tsort.h"
 
 #ifdef strcasecmp
 #undef strcasecmp
@@ -16483,7 +16484,7 @@ _PUBLIC_ int codepoint_cmpi(codepoint_t c1, codepoint_t c2)
            toupper_m(c1) == toupper_m(c2)) {
                return 0;
        }
-       return c1 - c2;
+       return NUMERIC_CMP(c1, c2);
 }