From: Howard Chu Date: Sun, 23 Mar 2003 16:00:20 +0000 (+0000) Subject: ITS#2364 fix unterminated AttributeName array X-Git-Tag: NO_SLAP_OP_BLOCKS~62 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1d772b3df6b3c8ad8255ccbc8e6a8455180a9046;p=openldap ITS#2364 fix unterminated AttributeName array --- diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 6c8e47938b..6dc94495a2 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -1400,7 +1400,7 @@ slapi_send_ldap_search_entry( } if ( i > 0 ) { - an = (AttributeName *) ch_malloc( i * sizeof(AttributeName) ); + an = (AttributeName *) ch_malloc( (i+1) * sizeof(AttributeName) ); for ( i = 0; attrs[i] != NULL; i++ ) { an[i].an_name.bv_val = ch_strdup( attrs[i] ); an[i].an_name.bv_len = strlen( attrs[i] ); @@ -1408,6 +1408,8 @@ slapi_send_ldap_search_entry( if( slap_bv2ad( &an[i].an_name, &an[i].an_desc, &text ) != LDAP_SUCCESS) return -1; } + an[i].an_name.bv_len = 0; + an[i].an_name.bv_val = NULL; } if ( ( rc = slapi_pblock_get( pb, SLAPI_BACKEND, (void *)&be ) != 0 ) ||