Fix critical bug in evbuffer_write when writev is not available

evbuffer_pullup() returns NULL if you try to pull up more bytes than
are there.  But evbuffer_write_atmost would sometimes ask for more
bytes to be pulled up than it had, get a NULL, and fail.
This commit is contained in:
Nick Mathewson 2010-03-31 12:29:26 -04:00
parent c87272b7b9
commit cda56abf19

View File

@ -1969,7 +1969,7 @@ evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
goto done;
}
if (howmuch < 0)
if (howmuch < 0 || howmuch > buffer->total_len)
howmuch = buffer->total_len;
{