From: Pierangelo Masarati Date: Tue, 29 Jan 2002 08:58:34 +0000 (+0000) Subject: fix uninitialized last (NULL) entry in BerVarray X-Git-Tag: LDBM_POST_GIANT_RWLOCK~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9b8ffc30ed118ce7d2a6fa23d0a3e3bacd5e77c5;p=openldap fix uninitialized last (NULL) entry in BerVarray --- diff --git a/servers/slapd/back-monitor/backend.c b/servers/slapd/back-monitor/backend.c index 17e1b41657..a9f324ed49 100644 --- a/servers/slapd/back-monitor/backend.c +++ b/servers/slapd/back-monitor/backend.c @@ -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 ); diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index 85df772f4c..13ce9d5838 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -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; }