diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-03-09 13:17:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-03-09 13:17:20 -0400 |
commit | 448bd220928f337e60dd377e8a3bb814248f4a7a (patch) | |
tree | 6d3d49eb15b0967385ce065050d87df6a046941a /src | |
parent | 62631904cb403ee9f27080a1cf096e8ddd8a3048 (diff) | |
parent | ceb6dee4652567fd503e5ceb9345354efd935a1b (diff) | |
download | tor-448bd220928f337e60dd377e8a3bb814248f4a7a.tar.gz tor-448bd220928f337e60dd377e8a3bb814248f4a7a.zip |
Merge remote-tracking branch 'public/bug14261_025' into maint-0.2.5
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 298271f366..50863d0c7e 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2183,12 +2183,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); @@ -2207,7 +2210,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: " "denial of service attempt, or you need to upgrade?"); connection_mark_for_close(TO_CONN(conn)); |