From: Kurt Zeilenga Date: Thu, 12 Apr 2001 23:05:02 +0000 (+0000) Subject: Fix off by one bug X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1473 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=66fdd720f41bbfa4c5e22523c1229d3380176fe7;p=openldap Fix off by one bug --- diff --git a/libraries/libldap/schema.c b/libraries/libldap/schema.c index 06c41b094d..094e9e06cc 100644 --- a/libraries/libldap/schema.c +++ b/libraries/libldap/schema.c @@ -126,6 +126,10 @@ append_to_safe_string(safe_string * ss, char * s) /* We always make sure there is at least one position available */ if ( ss->pos + l >= ss->size-1 ) { ss->size *= 2; + if ( ss->pos + l >= ss->size-1 ) { + ss->size = ss->pos + l + 1; + } + temp = LDAP_REALLOC(ss->val, ss->size); if ( !temp ) { /* Trouble, out of memory */