From: Howard Chu Date: Sat, 1 Dec 2007 11:14:40 +0000 (+0000) Subject: Fix carries X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~372 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d4baa7dc871fe84cbaeaa05e44b52515b8096ccc;p=openldap Fix carries --- diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 30738c869c..a96fa060cf 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -638,6 +638,9 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp ) part >>= 8; } } + j++; + prev->beg += j; + prev->len -= j; } out = tmp + prev->bufsiz; @@ -648,8 +651,11 @@ scale( int new, lutil_int_decnum *prev, unsigned char *tmp ) out[i] = new & 0xff; new >>= 8; } while ( new ); - prev->beg = prev->bufsiz + i; - prev->len = -i; + i = -i; + if ( prev->len < i ) { + prev->beg = prev->bufsiz - i; + prev->len = i; + } AC_MEMCPY( prev->buf+prev->beg, tmp+prev->beg, prev->len ); }