From 9601e1e7ec77de18001173f4b19416ef321ad830 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sat, 30 Jul 2005 23:30:42 +0000 Subject: [PATCH] serialNumberAndIssuerPretty() and serialNumberAndIssuerNormalize() were confused about realloced memory. --- servers/slapd/schema_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 7b5d1ff435..6c7fb42a69 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -2434,13 +2434,14 @@ serialNumberAndIssuerPretty( out->bv_len = sn.bv_len + newi.bv_len + 1; out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx ); - if( BER_BVISNULL( out ) ) { + if( out->bv_val == NULL ) { + out->bv_len = 0; slap_sl_free( newi.bv_val, ctx ); return LDAP_OTHER; } /* push issuer over */ - AC_MEMCPY( &out->bv_val[sn.bv_len+1], newi.bv_val, newi.bv_len ); + AC_MEMCPY( &out->bv_val[sn.bv_len+1], out->bv_val, newi.bv_len ); /* insert sn and "$" */ AC_MEMCPY( out->bv_val, sn.bv_val, sn.bv_len ); out->bv_val[sn.bv_len] = '$'; @@ -2510,13 +2511,14 @@ serialNumberAndIssuerNormalize( out->bv_len = sn.bv_len + newi.bv_len + 1; out->bv_val = slap_sl_realloc( newi.bv_val, out->bv_len + 1, ctx ); - if( BER_BVISNULL( out ) ) { + if( out->bv_val == NULL ) { + out->bv_len = 0; slap_sl_free( newi.bv_val, ctx ); return LDAP_OTHER; } /* push issuer over */ - AC_MEMCPY( &out->bv_val[sn.bv_len+1], newi.bv_val, newi.bv_len ); + AC_MEMCPY( &out->bv_val[sn.bv_len+1], out->bv_val, newi.bv_len ); /* insert sn and "$" */ AC_MEMCPY( out->bv_val, sn.bv_val, sn.bv_len ); out->bv_val[sn.bv_len] = '$'; -- 2.39.5