diff options
author | lilei <dlilei@126.com> | 2021-02-03 14:19:57 +0800 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2021-02-04 00:20:36 +0300 |
commit | bc25889fb3738cdd4d85e3ac162fd6cb2fde9839 (patch) | |
tree | 5f36a9e6b3d060cd945265e1431a14a5fe0edd28 /include | |
parent | f17eb6f509b41f0f9ccb719cb939d3dad2f143cf (diff) | |
download | libevent-bc25889fb3738cdd4d85e3ac162fd6cb2fde9839.tar.gz |
Check return value of evbuffer_remove() in bufferevent_read()
The conflict cast convertion between the return value of
bufferevent_read() and evbuffer_remove(), int(-1)->size_t(An undefined
maximum)
Add test case of bufferevent_read() should return 0 in case of
evbuffer_remove() returns -1
Fixes: #1132
Diffstat (limited to 'include')
-rw-r--r-- | include/event2/bufferevent.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/event2/bufferevent.h b/include/event2/bufferevent.h index 987b7eca..58baf831 100644 --- a/include/event2/bufferevent.h +++ b/include/event2/bufferevent.h @@ -430,7 +430,8 @@ int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer *buf); @param bufev the bufferevent to be read from @param data pointer to a buffer that will store the data @param size the size of the data buffer, in bytes - @return the amount of data read, in bytes. + @return the amount of data read, in bytes. If 0 is returned, it is possible + that there is no data in the buffer or that the read failed. */ EVENT2_EXPORT_SYMBOL size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size); |