From: Pierangelo Masarati Date: Tue, 17 Aug 2010 01:05:40 +0000 (+0000) Subject: fix previous commit (ITS#6611) X-Git-Tag: MIGRATION_CVS2GIT~520 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=672e87776adc00ba4cef656b5639e8815bbbf213;p=openldap fix previous commit (ITS#6611) --- diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index 7a1b43314d..b37e99d545 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -2538,7 +2538,7 @@ str2access( const char *str ) static char * safe_strncopy( char *ptr, const char *src, size_t n, struct berval *buf ) { - while ( &ptr[n] >= &buf->bv_val[buf->bv_len] ) { + while ( ptr + n >= buf->bv_val + buf->bv_len ) { char *tmp = ch_realloc( buf->bv_val, 2*buf->bv_len ); if ( tmp == NULL ) { return NULL; @@ -2782,10 +2782,9 @@ acl_unparse( AccessControl *a, struct berval *bv ) aclbuf.bv_len = ACLBUF_CHUNKSIZE; } - bv->bv_val = aclbuf.bv_val; bv->bv_len = 0; - ptr = bv->bv_val; + ptr = aclbuf.bv_val; ptr = acl_safe_strcopy( ptr, "to" ); if ( !BER_BVISNULL( &a->acl_dn_pat ) ) { @@ -2853,6 +2852,7 @@ acl_unparse( AccessControl *a, struct berval *bv ) ptr = access2text( b, ptr ); } *ptr = '\0'; + bv->bv_val = aclbuf.bv_val; bv->bv_len = ptr - bv->bv_val; }