From: Alan T. DeKok Date: Tue, 8 May 2018 20:57:05 +0000 (-0400) Subject: do dup checks on the correct field X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f847397fed5a7df33b022b73fac0375fd0bc6d94;p=thirdparty%2Ffreeradius-server.git do dup checks on the correct field --- diff --git a/src/modules/proto_vmps/proto_vmps_udp.c b/src/modules/proto_vmps/proto_vmps_udp.c index 4a75dc7130d..56e5a89ad55 100644 --- a/src/modules/proto_vmps/proto_vmps_udp.c +++ b/src/modules/proto_vmps/proto_vmps_udp.c @@ -400,21 +400,19 @@ static int mod_fd(void const *instance) static int mod_compare(UNUSED void const *instance, void const *one, void const *two) { int rcode; - uint8_t const *a = one; uint8_t const *b = two; /* - * The tree is ordered by IDs, which are (hopefully) - * pseudo-randomly distributed. + * Order by transaction ID */ - rcode = (a[1] < b[1]) - (a[1] > b[1]); + rcode = memcmp(a + 4, b + 4, 4); if (rcode != 0) return rcode; /* - * Then ordered by code, which is usally the same. + * Then ordered by opcode, which is usally the same. */ - return (a[0] < b[0]) - (a[0] > b[0]); + return (a[1] < b[1]) - (a[1] > b[1]); }