diff options
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index f67f44cb6a..13fda0fb55 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1019,8 +1019,10 @@ static int buf_find_pos_of_char(char ch, buf_pos_t *out) { const chunk_t *chunk; - int offset = 0; - int pos = out->pos; + int offset = 0; /*XXXX020 should this be pos_absolute? Otherwise, bug. */ + int pos; + tor_assert(out && out->chunk && out->pos < (int)out->chunk->datalen); + pos = out->pos; for (chunk = out->chunk; chunk; chunk = chunk->next) { char *cp = memchr(chunk->data+pos, ch, chunk->datalen-pos); if (cp) { |