summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-11-30 11:05:40 -0500
committerNick Mathewson <nickm@torproject.org>2014-11-30 11:05:40 -0500
commitba59923ab8cade9f2b306b4ae35c2f752786a8d3 (patch)
tree3bb48551ae315e06447e5b600cef4e2002ff4387
parent4f360f89ca1e089732853463fd0bc07d95142704 (diff)
downloadlibevent-ba59923ab8cade9f2b306b4ae35c2f752786a8d3.tar.gz
Fix evbuffer_peek() with len==-1 and start_at non-NULL.
-rw-r--r--buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index f5a52104..231f1914 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2742,7 +2742,10 @@ evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
if (n_vec == 0 && len < 0) {
/* If no vectors are provided and they asked for "everything",
* pretend they asked for the actual available amount. */
- len = buffer->total_len - len_so_far;
+ len = buffer->total_len;
+ if (start_at) {
+ len -= start_at->pos;
+ }
}
while (chain) {