From: Azat Khuzhin Date: Mon, 14 Aug 2017 20:03:48 +0000 (+0300) Subject: Fix wrong assert in evbuffer_drain() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b26996a05d9e7aad32e78a7bfab6454d5c11500a;p=libevent Fix wrong assert in evbuffer_drain() "chain" cannot be NULL here because we have at least one chain (we handle empty buffer separatelly) and hence loop will be executed at least once. Link: https://github.com/libevent/libevent/commit/841ecbd96105c84ac2e7c9594aeadbcc6fb38bc4#commitcomment-23631347 Signed-off-by: Ivan Maidanski Signed-off-by: Azat Khuzhin --- diff --git a/buffer.c b/buffer.c index be958feb..9a7b2a6a 100644 --- a/buffer.c +++ b/buffer.c @@ -1146,7 +1146,7 @@ evbuffer_drain(struct evbuffer *buf, size_t len) } buf->first = chain; - EVUTIL_ASSERT(chain && remaining <= chain->off); + EVUTIL_ASSERT(remaining < chain->off); chain->misalign += remaining; chain->off -= remaining; }