diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-03-09 11:10:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-03-09 11:10:04 -0400 |
commit | bd80ba9a9fd8309dc97e812e6e889dc3ad622b86 (patch) | |
tree | 42fad675b66ae21d8bedddb32161cd5e0c32367a /src | |
parent | 034f51dd0223b4d2969a3ecc2f0dc661b07bc6f1 (diff) | |
parent | a7f75b2056b8bdf59d064268c53a10ac46972380 (diff) | |
download | tor-bd80ba9a9fd8309dc97e812e6e889dc3ad622b86.tar.gz tor-bd80ba9a9fd8309dc97e812e6e889dc3ad622b86.zip |
Merge remote-tracking branch 'origin/maint-0.2.6'
Diffstat (limited to 'src')
-rw-r--r-- | src/or/buffers.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index 9f5dc70ed5..be9974418d 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -232,7 +232,7 @@ buf_pullup(buf_t *buf, size_t bytes, int nulterminate) size_t n = bytes - dest->datalen; src = dest->next; tor_assert(src); - if (n > src->datalen) { + if (n >= src->datalen) { memcpy(CHUNK_WRITE_PTR(dest), src->data, src->datalen); dest->datalen += src->datalen; dest->next = src->next; @@ -2436,7 +2436,14 @@ assert_buf_ok(buf_t *buf) total += ch->datalen; tor_assert(ch->datalen <= ch->memlen); tor_assert(ch->data >= &ch->mem[0]); - tor_assert(ch->data < &ch->mem[0]+ch->memlen); + tor_assert(ch->data <= &ch->mem[0]+ch->memlen); + if (ch->data == &ch->mem[0]+ch->memlen) { + static int warned = 0; + if (! warned) { + log_warn(LD_BUG, "Invariant violation in buf.c related to #15083"); + warned = 1; + } + } tor_assert(ch->data+ch->datalen <= &ch->mem[0] + ch->memlen); if (!ch->next) tor_assert(ch == buf->tail); |