From: Nick Porter Date: Fri, 12 May 2023 16:11:33 +0000 (+0100) Subject: If either bind_dn is NULL, just compare the pointers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1506c7d7858f0e2703e027b04b5aa2bcbf9fd267;p=thirdparty%2Ffreeradius-server.git If either bind_dn is NULL, just compare the pointers Anonymous binds don't populate bind_dn, and strcmp on a NULL pointer will seg fault --- diff --git a/src/lib/ldap/base.h b/src/lib/ldap/base.h index 92bda7ee555..fa6b6bb6822 100644 --- a/src/lib/ldap/base.h +++ b/src/lib/ldap/base.h @@ -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); }