]> git.sur5r.net Git - openldap/commitdiff
fix uninitialized last (NULL) entry in BerVarray
authorPierangelo Masarati <ando@openldap.org>
Tue, 29 Jan 2002 08:58:34 +0000 (08:58 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 29 Jan 2002 08:58:34 +0000 (08:58 +0000)
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/database.c

index 17e1b41657359a0a5458033382a0b146aca95c09..a9f324ed49468eb98b7f4bb9016e8641e9e053c9 100644 (file)
@@ -51,7 +51,6 @@ monitor_subsys_backend_init(
        Entry                   *e, *e_backend, *e_tmp;
        int                     i;
        struct monitorentrypriv *mp;
-       struct berval           bv[2];
 
        mi = ( struct monitorinfo * )be->be_private;
 
@@ -73,11 +72,11 @@ monitor_subsys_backend_init(
                return( -1 );
        }
 
-       bv[1].bv_val = NULL;
        e_tmp = NULL;
        for ( i = nBackendInfo; i--; ) {
-               char buf[1024];
-               BackendInfo *bi;
+               char            buf[1024];
+               BackendInfo     *bi;
+               struct berval   bv[ 2 ];
 
                bi = &backendInfo[i];
 
@@ -110,6 +109,7 @@ monitor_subsys_backend_init(
                
                bv[0].bv_val = bi->bi_type;
                bv[0].bv_len = strlen( bv[0].bv_val );
+               bv[1].bv_val = NULL;
 
                attr_merge( e, monitor_ad_desc, bv );
                attr_merge( e_backend, monitor_ad_desc, bv );
index 85df772f4c65fa6cae1e3d6b2f5d72d25c33ca57..13ce9d58389c114d99b0e67bd0a23d19d063670d 100644 (file)
@@ -50,7 +50,6 @@ monitor_subsys_database_init(
        AttributeDescription    *ad_nc = slap_schema.si_ad_namingContexts;
        AttributeDescription    *ad_seeAlso = NULL;
        const char              *text = NULL;
-       struct berval           bv[2];
 
        assert( be != NULL );
        assert( monitor_ad_desc != NULL );
@@ -116,7 +115,10 @@ monitor_subsys_database_init(
                }
                
                for ( j = 0; be->be_suffix[j]; j++ ) {
-                       bv[0] = *be->be_suffix[j];
+                       struct berval           bv[ 2 ];
+
+                       bv[ 0 ] = *be->be_suffix[ j ];
+                       bv[ 1 ].bv_val = NULL;
 
                        attr_merge( e, ad_nc, bv );
                        attr_merge( e_database, ad_nc, bv );
@@ -124,6 +126,8 @@ monitor_subsys_database_init(
 
                for ( j = nBackendInfo; j--; ) {
                        if ( &backendInfo[ j ] == be->bd_info ) {
+                               struct berval           bv[ 2 ];
+
                                /* we check the pointer; the test on the
                                 * string should be more reliable */
                                assert( strcasecmp( backendInfo[ j ].bi_type,
@@ -132,8 +136,9 @@ monitor_subsys_database_init(
                                snprintf( buf, sizeof( buf ), 
                                        "cn=Backend %d,%s", 
                                        j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
-                               bv->bv_val = buf;
-                               bv->bv_len = strlen( buf );
+                               bv[ 0 ].bv_val = buf;
+                               bv[ 0 ].bv_len = strlen( buf );
+                               bv[ 1 ].bv_val = NULL;
                                attr_merge( e, ad_seeAlso, bv );
                                break;
                        }