[Privoxy-commits] [privoxy] 08/16: get_destination_from_https_headers(): Properly handle IPv6 addresses
User Git
git at git.privoxy.org
Thu Oct 9 11:51:30 CEST 2025
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository privoxy.
commit 97316c794f7b3ef676e1299a3b41c1ac80f07101
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Thu Sep 11 14:37:38 2025 +0200
get_destination_from_https_headers(): Properly handle IPv6 addresses
---
parsers.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/parsers.c b/parsers.c
index 1b7e2de2..2ab405fa 100644
--- a/parsers.c
+++ b/parsers.c
@@ -5040,7 +5040,35 @@ jb_err get_destination_from_https_headers(const struct list *headers, struct htt
http->hostport = p;
freez(http->host);
http->host = q;
- q = strchr(http->host, ':');
+ if (*p == '[')
+ {
+ /* Numeric IPv6 address delimited by brackets */
+ p++;
+
+ q = strchr(p, ']');
+ if (q == NULL)
+ {
+ /* Missing closing bracket */
+ return JB_ERR_PARSE;
+ }
+
+ *q++ = '\0';
+
+ if (*q == '\0')
+ {
+ q = NULL;
+ }
+ else if (*q != ':')
+ {
+ /* Garbage after closing bracket */
+ return JB_ERR_PARSE;
+ }
+ }
+ else
+ {
+ /* Plain non-escaped hostname */
+ q = strchr(http->host, ':');
+ }
if (q != NULL)
{
/* Terminate hostname and evaluate port string */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Privoxy-commits
mailing list