diff --git a/libraries/libldap/filter.c b/libraries/libldap/filter.c index 60fd907975..c3621bc720 100644 --- a/libraries/libldap/filter.c +++ b/libraries/libldap/filter.c @@ -721,14 +721,15 @@ put_substring_filter( BerElement *ber, char *type, char *val ) if ( *nextstar == '\0' ) { ftype = LDAP_SUBSTRING_FINAL; - } else if ( gotstar++ == 0 ) { - ftype = LDAP_SUBSTRING_INITIAL; } else { - ftype = LDAP_SUBSTRING_ANY; + *nextstar++ = '\0'; + if ( gotstar++ == 0 ) { + ftype = LDAP_SUBSTRING_INITIAL; + } else { + ftype = LDAP_SUBSTRING_ANY; + } } - *nextstar++ = '\0'; - if ( *val != '\0' || ftype == LDAP_SUBSTRING_ANY ) { ber_slen_t len = ldap_pvt_filter_value_unescape( val );