]> git.sur5r.net Git - openldap/commitdiff
LDAPworld P9: SLAPD crashes with filter containing zero elements
authorKurt Zeilenga <kurt@openldap.org>
Sun, 9 Aug 1998 02:52:09 +0000 (02:52 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 9 Aug 1998 02:52:09 +0000 (02:52 +0000)
servers/slapd/filter.c

index 8d990b361d4b42ce5f137437199b1acb78858d97..50016fe6ba4f222e15f807404debd92063d1975c 100644 (file)
@@ -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 );