]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
debuginfod-client: Use CURLOPT_MAXREDIRS
authorMark Wielaard <mark@klomp.org>
Wed, 13 May 2026 13:57:57 +0000 (15:57 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 14 May 2026 00:31:22 +0000 (02:31 +0200)
Guard against bad servers. Older libcurl allowed unlimited
redirects. Newer libcurl default to max 30. Explicitly set
CURLOPT_MAXREDIRS to 6 (twice the number of redirects that seems
"reasonable"). This guards against badly setup servers that keep
redirecting. https://curl.se/libcurl/c/CURLOPT_MAXREDIRS.html

* debuginfod/debuginfod-client.c (init_handle): Add
CURLOPT_MAXREDIRS curl_easy_setopt_ck.

Signed-off-by: Mark Wielaard <mark@klomp.org>
debuginfod/debuginfod-client.c

index fb9ad82f7f5d32ab4cf15dc33e89132ad41c774b..6340c8c27a4fdb4d969974213ea9b5079d65caa7 100644 (file)
@@ -1008,6 +1008,7 @@ init_handle(debuginfod_client *client,
     }
   curl_easy_setopt_ck(data->handle, CURLOPT_FILETIME, (long) 1);
   curl_easy_setopt_ck(data->handle, CURLOPT_FOLLOWLOCATION, (long) 1);
+  curl_easy_setopt_ck(data->handle, CURLOPT_MAXREDIRS, (long) 6);
   curl_easy_setopt_ck(data->handle, CURLOPT_FAILONERROR, (long) 1);
   curl_easy_setopt_ck(data->handle, CURLOPT_NOSIGNAL, (long) 1);
   if (h_callback)