mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Change some >=s to >s in buf_resize, so that we do not denormalize buffers on resize.
svn:r4172
This commit is contained in:
parent
86e73d7005
commit
8b9ae25224
@ -138,9 +138,9 @@ static void buf_resize(buf_t *buf, size_t new_capacity)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offset = buf->cur - buf->mem;
|
offset = buf->cur - buf->mem;
|
||||||
if (offset + buf->datalen >= new_capacity) {
|
if (offset + buf->datalen > new_capacity) {
|
||||||
/* We need to move stuff before we shrink. */
|
/* We need to move stuff before we shrink. */
|
||||||
if (offset+buf->datalen >= buf->len) {
|
if (offset + buf->datalen > buf->len) {
|
||||||
/* We have:
|
/* We have:
|
||||||
*
|
*
|
||||||
* mem[0] ... mem[datalen-(len-offset)] (end of data)
|
* mem[0] ... mem[datalen-(len-offset)] (end of data)
|
||||||
@ -165,7 +165,7 @@ static void buf_resize(buf_t *buf, size_t new_capacity)
|
|||||||
ALLOC_LEN(new_capacity)));
|
ALLOC_LEN(new_capacity)));
|
||||||
SET_GUARDS(buf->mem, new_capacity);
|
SET_GUARDS(buf->mem, new_capacity);
|
||||||
buf->cur = buf->mem+offset;
|
buf->cur = buf->mem+offset;
|
||||||
if (offset + buf->datalen >= buf->len) {
|
if (offset + buf->datalen > buf->len) {
|
||||||
/* We need to move data now that we are done growing. The buffer
|
/* We need to move data now that we are done growing. The buffer
|
||||||
* now contains:
|
* now contains:
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user