mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Backport: do not believe negative result from FIONREAD.
svn:r1429
This commit is contained in:
parent
8c6282ec39
commit
81765181c6
@ -1,3 +1,6 @@
|
||||
Changes in 1.4.13-stable:
|
||||
o If the kernel tells us that there are a negative number of bytes to read from a socket, do not believe it. Fixes bug 2841177; found by Alexander Pronchenkov.
|
||||
|
||||
Changes in 1.4.12-stable:
|
||||
o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
|
||||
o Fix an obscure timing-dependent, allocator-dependent crash in the evdns code.
|
||||
|
4
buffer.c
4
buffer.c
@ -357,9 +357,9 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch)
|
||||
#if defined(FIONREAD)
|
||||
#ifdef WIN32
|
||||
long lng = n;
|
||||
if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) == 0) {
|
||||
if (ioctlsocket(fd, FIONREAD, &lng) == -1 || (n=lng) <= 0) {
|
||||
#else
|
||||
if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) {
|
||||
if (ioctl(fd, FIONREAD, &n) == -1 || n <= 0) {
|
||||
#endif
|
||||
n = EVBUFFER_MAX_READ;
|
||||
} else if (n > EVBUFFER_MAX_READ && n > howmuch) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user