3 @@ -610,6 +610,11 @@ add_header_to_connection (hashmap_t hash
4 return hashmap_insert (hashofheaders, header, sep, len);
7 +/* define max number of headers. big enough to handle legitimate cases,
8 + * but limited to avoid DoS
10 +#define MAX_HEADERS 10000
13 * Read all the headers from the stream
15 @@ -617,6 +622,7 @@ static int get_all_headers (int fd, hash
23 @@ -625,7 +631,7 @@ static int get_all_headers (int fd, hash
25 assert (hashofheaders != NULL);
28 + for (count = 0; count < MAX_HEADERS; count++) {
29 if ((linelen = readline (fd, &line)) <= 0) {
32 @@ -691,6 +697,12 @@ static int get_all_headers (int fd, hash
37 + /* if we get there, this is we reached MAX_HEADERS count.
38 + bail out with error */