]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
If either bind_dn is NULL, just compare the pointers
authorNick Porter <nick@portercomputing.co.uk>
Fri, 12 May 2023 16:11:33 +0000 (17:11 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Fri, 12 May 2023 16:11:33 +0000 (17:11 +0100)
Anonymous binds don't populate bind_dn, and strcmp on a NULL pointer
will seg fault

src/lib/ldap/base.h

index 92bda7ee5553d43b50a4383a82d97975ddafd9a2..fa6b6bb6822416bf384b58fd797ac1bb0dbe7235 100644 (file)
@@ -673,6 +673,7 @@ static inline int8_t fr_ldap_trunk_cmp(void const *one, void const *two)
        int8_t uricmp = CMP(strcmp(a->uri, b->uri), 0);
 
        if (uricmp !=0) return uricmp;
+       if (!a->bind_dn || !b->bind_dn) return CMP(a->bind_dn, b->bind_dn);
        return CMP(strcmp(a->bind_dn, b->bind_dn), 0);
 }