mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 07:07:52 +01:00
Merge remote branch 'rransom/bug2327-v2'
This commit is contained in:
commit
8932753169
1 changed files with 8 additions and 4 deletions
|
@ -1954,13 +1954,17 @@ fetch_from_evbuffer_socks_client(struct evbuffer *buf, int state,
|
|||
size_t datalen;
|
||||
int r;
|
||||
|
||||
data = evbuffer_pullup(buf, 128); /* Make sure we have at least 128
|
||||
* contiguous bytes if possible. */
|
||||
datalen = evbuffer_get_contiguous_space(buf);
|
||||
/* Linearize the SOCKS response in the buffer, up to 128 bytes.
|
||||
* (parse_socks_client shouldn't need to see anything beyond that.) */
|
||||
datalen = evbuffer_get_length(buf);
|
||||
if (datalen > 128)
|
||||
datalen = 128;
|
||||
data = evbuffer_pullup(buf, datalen);
|
||||
|
||||
r = parse_socks_client(data, datalen, state, reason, &drain);
|
||||
if (drain > 0)
|
||||
evbuffer_drain(buf, drain);
|
||||
else
|
||||
else if (drain < 0)
|
||||
evbuffer_drain(buf, evbuffer_get_length(buf));
|
||||
|
||||
return r;
|
||||
|
|
Loading…
Add table
Reference in a new issue