From b8f5ec4d1a5eee00548fded12aba5b8d229a7bfb Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Sun, 4 May 2025 15:08:58 +0200
Subject: [PATCH] parse_http_url(): Fail if no host is found when we expected
one
This can happen in case of invalid requests in which case
Privoxy priviously would leak a couple of bytes of memory.
---
urlmatch.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/urlmatch.c b/urlmatch.c
index b6a61d96..b213c3eb 100644
--- a/urlmatch.c
+++ b/urlmatch.c
@@ -326,6 +326,11 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr
if (!host_available)
{
+ if (!require_protocol)
+ {
+ log_error(LOG_LEVEL_ERROR, "No host found in request line.");
+ return JB_ERR_PARSE;
+ }
/* Without host, there is nothing left to do here */
return JB_ERR_OK;
}
--
2.50.1