xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 56a145d6ca031841610daeebde99fbde0f8fcf21 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 26 Apr 2022 07:46:19 +0200
4Subject: [PATCH] gnutls: don't leak the SRP credentials in redirects
5
6Follow-up to 620ea21410030 and 139a54ed0a172a
7
8Reported-by: Harry Sintonen
9Closes #8752
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/093531556203decd92d92bccd431edbe5561781c]
12Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
13---
14 lib/vtls/gtls.c | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
18index 5749376..fe45b3a 100644
19--- a/lib/vtls/gtls.c
20+++ b/lib/vtls/gtls.c
21@@ -437,11 +437,11 @@ gtls_connect_step1(struct Curl_easy *data,
22   }
23
24 #ifdef HAVE_GNUTLS_SRP
25-  if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
26+  if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
27+     Curl_allow_auth_to_host(data)) {
28     infof(data, "Using TLS-SRP username: %s", SSL_SET_OPTION(username));
29
30-    rc = gnutls_srp_allocate_client_credentials(
31-           &backend->srp_client_cred);
32+    rc = gnutls_srp_allocate_client_credentials(&backend->srp_client_cred);
33     if(rc != GNUTLS_E_SUCCESS) {
34       failf(data, "gnutls_srp_allocate_client_cred() failed: %s",
35             gnutls_strerror(rc));
36