aboutsummaryrefslogtreecommitdiffstats
path: root/main/lynx/CVE-2021-38165.patch
blob: e8a767aaf5e1b58c2e6777ae0e3a2c22c5f1fa54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 71880f862c9cd9353511291f237af386c11b98ea Mon Sep 17 00:00:00 2001
From: "Thomas E. Dickey" <dickey@invisible-island.net>
Date: Sat, 7 Aug 2021 14:33:59 +0000
Subject: [PATCH] snapshot of project "lynx", label v2-9-0dev_8b

---
 WWW/Library/Implementation/HTTP.c | 20 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index 07e30d74..338a6ebd 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -764,6 +764,23 @@ static char *StripIpv6Brackets(char *host)
 }
 #endif
 
+/*
+ * Remove user/password, if any, from the given host-string.
+ */
+#ifdef USE_SSL
+static char *StripUserAuthents(char *host)
+{
+    char *p = strchr(host, '@');
+
+    if (p != NULL) {
+	char *q = host;
+
+	while ((*q++ = *++p) != '\0') ;
+    }
+    return host;
+}
+#endif
+
 /*		Load Document from HTTP Server			HTLoadHTTP()
  *		==============================
  *
@@ -959,6 +976,7 @@ static int HTLoadHTTP(const char *arg,
 	/* get host we're connecting to */
 	ssl_host = HTParse(url, "", PARSE_HOST);
 	ssl_host = StripIpv6Brackets(ssl_host);
+	ssl_host = StripUserAuthents(ssl_host);
 #if defined(USE_GNUTLS_FUNCS)
 	ret = gnutls_server_name_set(handle->gnutls_state,
 				     GNUTLS_NAME_DNS,