diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-01-18 15:28:35 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-01-18 15:28:35 -0500 |
commit | efdac2a68cb17de7c163a9abba05269888aacb88 (patch) | |
tree | cd57388f2aed51d384ae93ff147e6185093aa573 /src | |
parent | 79e12da86199fbfcf44aa7e569ea2d938156108b (diff) | |
parent | ceb6dee4652567fd503e5ceb9345354efd935a1b (diff) | |
download | tor-efdac2a68cb17de7c163a9abba05269888aacb88.tar.gz tor-efdac2a68cb17de7c163a9abba05269888aacb88.zip |
Merge remote-tracking branch 'public/bug14261_025'
Conflicts:
src/or/directory.c
Diffstat (limited to 'src')
-rw-r--r-- | src/or/directory.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 7b4020080c..4f24f84d9c 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2201,12 +2201,15 @@ connection_dir_reached_eof(dir_connection_t *conn) */ #define MAX_DIRECTORY_OBJECT_SIZE (10*(1<<20)) +#define MAX_VOTE_DL_SIZE (MAX_DIRECTORY_OBJECT_SIZE * 5) + /** Read handler for directory connections. (That's connections <em>to</em> * directory servers and connections <em>at</em> directory servers.) */ int connection_dir_process_inbuf(dir_connection_t *conn) { + size_t max_size; tor_assert(conn); tor_assert(conn->base_.type == CONN_TYPE_DIR); @@ -2225,7 +2228,11 @@ connection_dir_process_inbuf(dir_connection_t *conn) return 0; } - if (connection_get_inbuf_len(TO_CONN(conn)) > MAX_DIRECTORY_OBJECT_SIZE) { + max_size = + (TO_CONN(conn)->purpose == DIR_PURPOSE_FETCH_STATUS_VOTE) ? + MAX_VOTE_DL_SIZE : MAX_DIRECTORY_OBJECT_SIZE; + + if (connection_get_inbuf_len(TO_CONN(conn)) > max_size) { log_warn(LD_HTTP, "Too much data received from directory connection (%s): " "denial of service attempt, or you need to upgrade?", |