]> git.sur5r.net Git - openldap/commitdiff
ITS#6951 Fix two buffersize issue in "pcacheBind" config processing
authorRalf Haferkamp <ralf@openldap.org>
Tue, 24 May 2011 13:23:11 +0000 (15:23 +0200)
committerRalf Haferkamp <ralf@openldap.org>
Tue, 24 May 2011 13:36:15 +0000 (15:36 +0200)
Found with valgrind

servers/slapd/overlays/pcache.c

index cec3eca05ca8aa845da1b25ed8bf2c52fb7f34f4..62477513bdbbaacf56813b9af044b2d0c68554b9 100644 (file)
@@ -445,7 +445,7 @@ ftemp_attrs( struct berval *ftemp, struct berval *template,
        AttributeDescription **descs = NULL;
        char *temp2;
 
-       temp2 = ch_malloc( ftemp->bv_len );
+       temp2 = ch_malloc( ftemp->bv_len + 1 );
        p1 = ftemp->bv_val;
        t1 = temp2;
 
@@ -4263,7 +4263,7 @@ pc_bind_fail:
                        i = 0;
                        while ((eq = strchr(eq, '=' ))) {
                                eq++;
-                               if ( eq[1] == ')' )
+                               if ( eq[0] == ')' )
                                        i++;
                        }
                        bv.bv_len = temp->bindftemp.bv_len + i;