aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorBlake Burkhart <bburky@bburky.com>2015-09-22 18:06:20 -0400
committerJunio C Hamano <gitster@pobox.com>2015-09-25 15:32:28 -0700
commitb258116462399b318c86165c61a5c7123043cfd4 (patch)
tree0fab49f2d65cee265a23f3b95e84c57a0e38430f /http.c
parentf4113cac0c88b4f36ee6f3abf3218034440a68e3 (diff)
downloadgit-b258116462399b318c86165c61a5c7123043cfd4.tar.gz
git-b258116462399b318c86165c61a5c7123043cfd4.tar.xz
http: limit redirection depth
By default, libcurl will follow circular http redirects forever. Let's put a cap on this so that somebody who can trigger an automated fetch of an arbitrary repository (e.g., for CI) cannot convince git to loop infinitely. The value chosen is 20, which is the same default that Firefox uses. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/http.c b/http.c
index 5a57bccea..00e3fc80e 100644
--- a/http.c
+++ b/http.c
@@ -352,6 +352,7 @@ static CURL *get_curl_handle(void)
}
curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20);
#if LIBCURL_VERSION_NUM >= 0x071301
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
#elif LIBCURL_VERSION_NUM >= 0x071101