]> git.sur5r.net Git - openldap/commitdiff
not-so-easy-to-spot bug in filter writing
authorPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 18:01:15 +0000 (18:01 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 14 Feb 2002 18:01:15 +0000 (18:01 +0000)
libraries/libldap/filter.c

index 60fd907975a4d6ef06dd290029ae03301cd29dd4..c3621bc720106b5399df0b6a6c064ba1d22a82e0 100644 (file)
@@ -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 );