diff options
author | Azat Khuzhin <azat@libevent.org> | 2019-03-02 22:50:00 +0300 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2019-03-03 18:00:37 +0300 |
commit | fdfabbec00b36bc6d5e69b5d8719e70d6f4e5b7b (patch) | |
tree | 8108ee0bf83d69d404c687539e9e0c200aee9539 /buffer.c | |
parent | 91acedcc97bc5ffb77622041977920812d3fcc25 (diff) | |
download | libevent-fdfabbec00b36bc6d5e69b5d8719e70d6f4e5b7b.tar.gz |
buffer: fix evbuffer_remove_buffer() with empty chain in front
In case we have empty chain (chain that do not have any data, i.e. ->off
== 0) at the beginning of the buffer, and no more full chains to move to
the dst, we will skip moving of this empty chain, and hence
last_with_datap will not be adjusted, and things will be broken after.
Fix this by not relying on ->off, just count if we have something to
move that's it.
Test case from:
https://github.com/envoyproxy/envoy/pull/6062
Fixes: #774
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1299,7 +1299,7 @@ evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst, chain = chain->next; } - if (nread) { + if (chain != src->first) { /* we can remove the chain */ struct evbuffer_chain **chp; chp = evbuffer_free_trailing_empty_chains(dst); |