]> granicus.if.org Git - libevent/commitdiff
Fix wrong assert in evbuffer_drain()
authorAzat Khuzhin <a3at.mail@gmail.com>
Mon, 14 Aug 2017 20:03:48 +0000 (23:03 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Mon, 14 Aug 2017 20:11:03 +0000 (23:11 +0300)
"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 <i.maidanski@samsung.com>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
buffer.c

index be958febc7fc29a3d1de5ee2a6d84242eb3f910c..9a7b2a6a510098fe939b400fb05fd3eb995d1b29 100644 (file)
--- 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;
        }