diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ot_http.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ot_http.c b/src/ot_http.c index fc49333..1b5281c 100644 --- a/src/ot_http.c +++ b/src/ot_http.c | |||
| @@ -762,8 +762,8 @@ ssize_t http_handle_request(const int64_t sock, struct ot_workstruct *ws) { | |||
| 762 | } | 762 | } |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | /* This one implicitely tests strlen < 5, too -- remember, it is \n terminated */ | 765 | /* The request need not be NUL terminated and can be shorter than the literal */ |
| 766 | if (memcmp(read_ptr, "GET /", 5)) | 766 | if (ws->request_size < 5 || memcmp(read_ptr, "GET /", 5)) |
| 767 | HTTPERROR_400; | 767 | HTTPERROR_400; |
| 768 | 768 | ||
| 769 | /* Skip leading '/' */ | 769 | /* Skip leading '/' */ |
| @@ -786,7 +786,7 @@ ssize_t http_handle_request(const int64_t sock, struct ot_workstruct *ws) { | |||
| 786 | if ((*write_ptr == 'a') || (*write_ptr == '?')) | 786 | if ((*write_ptr == 'a') || (*write_ptr == '?')) |
| 787 | http_handle_announce(sock, ws, read_ptr); | 787 | http_handle_announce(sock, ws, read_ptr); |
| 788 | #ifdef WANT_FULLSCRAPE | 788 | #ifdef WANT_FULLSCRAPE |
| 789 | else if (!memcmp(write_ptr, "scrape HTTP/", 12)) | 789 | else if (ws->request + ws->request_size - write_ptr >= 12 && !memcmp(write_ptr, "scrape HTTP/", 12)) |
| 790 | http_handle_fullscrape(sock, ws); | 790 | http_handle_fullscrape(sock, ws); |
| 791 | #endif | 791 | #endif |
| 792 | /* This is the hardcore match for scrape */ | 792 | /* This is the hardcore match for scrape */ |
