blob: 4e2157ca75d18c8a135936efc8fd5f62131c5ec6 [file] [log] [blame]
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001From 3764b8551463b900b5b4e3ec0cd9bb9182191cb7 Mon Sep 17 00:00:00 2001
2From: rofl0r <rofl0r@users.noreply.github.com>
3Date: Thu, 8 Sep 2022 15:18:04 +0000
4Subject: [PATCH] prevent junk from showing up in error page in invalid
5 requests
6
7fixes #457
8
9https://github.com/tinyproxy/tinyproxy/commit/3764b8551463b900b5b4e3ec0cd9bb9182191cb7
10Upstream-Status: Backport
11CVE: CVE-2022-40468
12Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
13---
14 src/reqs.c | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/src/reqs.c b/src/reqs.c
18index bce69819..45db118d 100644
19--- a/src/reqs.c
20+++ b/src/reqs.c
21@@ -343,8 +343,12 @@ static struct request_s *process_request (struct conn_s *connptr,
22 goto fail;
23 }
24
25+ /* zero-terminate the strings so they don't contain junk in error page */
26+ request->method[0] = url[0] = request->protocol[0] = 0;
27+
28 ret = sscanf (connptr->request_line, "%[^ ] %[^ ] %[^ ]",
29 request->method, url, request->protocol);
30+
31 if (ret == 2 && !strcasecmp (request->method, "GET")) {
32 request->protocol[0] = 0;
33