0001-prevent-junk-from-showing-up-in-error-page-in-invalid-requests.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. From 3764b8551463b900b5b4e3ec0cd9bb9182191cb7 Mon Sep 17 00:00:00 2001
  2. From: rofl0r <rofl0r@users.noreply.github.com>
  3. Date: Thu, 8 Sep 2022 15:18:04 +0000
  4. Subject: [PATCH] prevent junk from showing up in error page in invalid
  5. requests
  6. fixes #457
  7. [Retrieved from:
  8. https://github.com/tinyproxy/tinyproxy/commit/3764b8551463b900b5b4e3ec0cd9bb9182191cb7]
  9. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  10. ---
  11. src/reqs.c | 4 ++++
  12. 1 file changed, 4 insertions(+)
  13. diff --git a/src/reqs.c b/src/reqs.c
  14. index bce69819..45db118d 100644
  15. --- a/src/reqs.c
  16. +++ b/src/reqs.c
  17. @@ -343,8 +343,12 @@ static struct request_s *process_request (struct conn_s *connptr,
  18. goto fail;
  19. }
  20. + /* zero-terminate the strings so they don't contain junk in error page */
  21. + request->method[0] = url[0] = request->protocol[0] = 0;
  22. +
  23. ret = sscanf (connptr->request_line, "%[^ ] %[^ ] %[^ ]",
  24. request->method, url, request->protocol);
  25. +
  26. if (ret == 2 && !strcasecmp (request->method, "GET")) {
  27. request->protocol[0] = 0;