parse_http_url(): Fail if no host is found when we expected one
authorFabian Keil <fk@fabiankeil.de>
Sun, 4 May 2025 13:08:58 +0000 (15:08 +0200)
committerFabian Keil <fk@fabiankeil.de>
Wed, 18 Jun 2025 03:48:30 +0000 (05:48 +0200)
This can happen in case of invalid requests in which case
Privoxy priviously would leak a couple of bytes of memory.

urlmatch.c

index b6a61d9..b213c3e 100644 (file)
@@ -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;
    }