diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-04-29 08:32:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-04-29 08:32:44 -0400 |
commit | cbe9e56590b0ea354313667bf20e187dd5b1d556 (patch) | |
tree | f2131f4da93e052d8080fb8e970fa0ecace1a4d4 /src/core | |
parent | 3253c357eeae3434da62bf720a451aa19f0ddd32 (diff) | |
parent | 4dd4dbf046693be581dd05cdae1c62e68472d18e (diff) | |
download | tor-cbe9e56590b0ea354313667bf20e187dd5b1d556.tar.gz tor-cbe9e56590b0ea354313667bf20e187dd5b1d556.zip |
Merge remote-tracking branch 'tor-github/pr/1868/head'
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/mainloop/connection.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index 9602978458..db59e6b28d 100644 --- a/src/core/mainloop/connection.c +++ b/src/core/mainloop/connection.c @@ -3814,6 +3814,12 @@ connection_buf_read_from_socket(connection_t *conn, ssize_t *max_to_read, at_most = connection_bucket_read_limit(conn, approx_time()); } + /* Do not allow inbuf to grow past BUF_MAX_LEN. */ + const ssize_t maximum = BUF_MAX_LEN - buf_datalen(conn->inbuf); + if (at_most > maximum) { + at_most = maximum; + } + slack_in_buf = buf_slack(conn->inbuf); again: if ((size_t)at_most > slack_in_buf && slack_in_buf >= 1024) { |