diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-12-15 11:32:49 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-12-15 11:32:49 -0500 |
commit | e402edd96064ae853767dff459da2646bc70af5e (patch) | |
tree | 3906d58188766d99c6d497ea7cc48341a77c8043 /src/or/buffers.c | |
parent | 960f62bd82c249b456a0aa2e1ae62f68c754aacb (diff) | |
parent | 562c974ee7913b09bc1b19e4674dea618f2c6328 (diff) | |
download | tor-e402edd96064ae853767dff459da2646bc70af5e.tar.gz tor-e402edd96064ae853767dff459da2646bc70af5e.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/or/buffers.c')
-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 f4aac0f0e4..7c49423e16 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -401,9 +401,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; |