From: Kurt Zeilenga Date: Sun, 9 Aug 1998 02:52:09 +0000 (+0000) Subject: LDAPworld P9: SLAPD crashes with filter containing zero elements X-Git-Tag: LDAP_3_3+prerelease~27^2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=221db1f19a6f03e9fea56125ec16d5bbce80043d;p=openldap LDAPworld P9: SLAPD crashes with filter containing zero elements --- diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 8d990b361d..50016fe6ba 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -135,6 +135,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 ); if ( (err = get_filter_list( conn, ber, &f->f_and, &ftmp )) == 0 ) { + if (ftmp == NULL) ftmp = strdup(""); *fstr = ch_malloc( 4 + strlen( ftmp ) ); sprintf( *fstr, "(&%s)", ftmp ); free( ftmp ); @@ -145,6 +146,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) Debug( LDAP_DEBUG_FILTER, "OR\n", 0, 0, 0 ); if ( (err = get_filter_list( conn, ber, &f->f_or, &ftmp )) == 0 ) { + if (ftmp == NULL) ftmp = strdup(""); *fstr = ch_malloc( 4 + strlen( ftmp ) ); sprintf( *fstr, "(|%s)", ftmp ); free( ftmp ); @@ -155,6 +157,7 @@ get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) Debug( LDAP_DEBUG_FILTER, "NOT\n", 0, 0, 0 ); (void) ber_skip_tag( ber, &len ); if ( (err = get_filter( conn, ber, &f->f_not, &ftmp )) == 0 ) { + if (ftmp == NULL) ftmp = strdup(""); *fstr = ch_malloc( 4 + strlen( ftmp ) ); sprintf( *fstr, "(!%s)", ftmp ); free( ftmp );