File curl-CVE-2025-14524.patch of Package curl.42097

From 1a822275d333dc6da6043497160fd04c8fa48640 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Wed, 10 Dec 2025 11:40:47 +0100
Subject: [PATCH] curl_sasl: if redirected, require permission to use bearer

Closes #19933
---
 lib/curl_sasl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: curl-7.37.0/lib/url.c
===================================================================
--- curl-7.37.0.orig/lib/url.c
+++ curl-7.37.0/lib/url.c
@@ -5394,10 +5394,13 @@ static CURLcode create_conn(struct Sessi
   }
 
   if(data->set.str[STRING_BEARER]) {
-    conn->xoauth2_bearer = strdup(data->set.str[STRING_BEARER]);
-    if(!conn->xoauth2_bearer) {
-      result = CURLE_OUT_OF_MEMORY;
-      goto out;
+    if (!data->state.this_is_a_follow ||
+        data->set.allow_auth_to_other_hosts) {
+      conn->xoauth2_bearer = strdup(data->set.str[STRING_BEARER]);
+      if(!conn->xoauth2_bearer) {
+        result = CURLE_OUT_OF_MEMORY;
+        goto out;
+      }
     }
   }
 
openSUSE Build Service is sponsored by