]> git.sur5r.net Git - openldap/commitdiff
fix ber_bvreplace() in case dst is NULL and src is empty
authorPierangelo Masarati <ando@openldap.org>
Thu, 15 Jun 2006 01:42:25 +0000 (01:42 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 15 Jun 2006 01:42:25 +0000 (01:42 +0000)
libraries/liblber/memory.c

index f45ec52b68d8d6968d6e2a4d94b90d795f8cb134..614305c9ed243dd2fcc78e0c1f5aacd1f6541995 100644 (file)
@@ -701,7 +701,7 @@ ber_bvreplace_x( struct berval *dst, LDAP_CONST struct berval *src, void *ctx )
 {
        assert( dst != NULL );
 
-       if ( dst->bv_len < src->bv_len ) {
+       if ( dst->bv_len == 0 || dst->bv_len < src->bv_len ) {
                dst->bv_val = ber_memrealloc_x( dst->bv_val, src->bv_len + 1, ctx );
        }