diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-12-15 11:28:44 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-12-15 11:28:44 -0500 |
commit | 562c974ee7913b09bc1b19e4674dea618f2c6328 (patch) | |
tree | 45e9bc7b03b295fb392317ac55a288e47832c02a /src/or | |
parent | 0582746e0d25ef07e925521f9e6eb272725f64ee (diff) | |
parent | 9d0777839be6642954a4c064c819d406d8bb7cb4 (diff) | |
download | tor-562c974ee7913b09bc1b19e4674dea618f2c6328.tar.gz tor-562c974ee7913b09bc1b19e4674dea618f2c6328.zip |
Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/buffers.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 05163637f2..58e5f658b8 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -397,9 +397,10 @@ buf_pullup(buf_t *buf, size_t bytes, int nulterminate) if (buf->head->memlen >= capacity) { /* We don't need to grow the first chunk, but we might need to repack it.*/ - if (CHUNK_REMAINING_CAPACITY(buf->head) < capacity-buf->datalen) + size_t needed = capacity - buf->head->datalen; + if (CHUNK_REMAINING_CAPACITY(buf->head) < needed) chunk_repack(buf->head); - tor_assert(CHUNK_REMAINING_CAPACITY(buf->head) >= capacity-buf->datalen); + tor_assert(CHUNK_REMAINING_CAPACITY(buf->head) >= needed); } else { chunk_t *newhead; size_t newsize; |