From a7aec0ae6160be6aa6b1b2b06574bb0dd47497f2 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 4 Feb 2013 23:27:26 +0100 Subject: [PATCH] Add protection from infinite redirect loops to curl-using plugins Signed-off-by: Florian Forster --- src/apache.c | 1 + src/ascent.c | 1 + src/bind.c | 1 + src/curl.c | 1 + src/nginx.c | 1 + 5 files changed, 5 insertions(+) diff --git a/src/apache.c b/src/apache.c index 33ee1305..b1f9eaa3 100644 --- a/src/apache.c +++ b/src/apache.c @@ -457,6 +457,7 @@ static int init_host (apache_t *st) /* {{{ */ curl_easy_setopt (st->curl, CURLOPT_URL, st->url); curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (st->curl, CURLOPT_MAXREDIRS, 50L); if (st->verify_peer != 0) { diff --git a/src/ascent.c b/src/ascent.c index 3a7c3939..23783862 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -562,6 +562,7 @@ static int ascent_init (void) /* {{{ */ curl_easy_setopt (curl, CURLOPT_URL, url); curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L); if ((verify_peer == NULL) || IS_TRUE (verify_peer)) curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L); diff --git a/src/bind.c b/src/bind.c index c00f5ae9..32e9d04b 100644 --- a/src/bind.c +++ b/src/bind.c @@ -1389,6 +1389,7 @@ static int bind_init (void) /* {{{ */ curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error); curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL); curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L); return (0); } /* }}} int bind_init */ diff --git a/src/curl.c b/src/curl.c index 214fb519..39d8e02f 100644 --- a/src/curl.c +++ b/src/curl.c @@ -378,6 +378,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ curl_easy_setopt (wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf); curl_easy_setopt (wp->curl, CURLOPT_URL, wp->url); curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (wp->curl, CURLOPT_MAXREDIRS, 50L); if (wp->user != NULL) { diff --git a/src/nginx.c b/src/nginx.c index f1f3f99c..a73e4d24 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -143,6 +143,7 @@ static int init (void) } curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L); if ((verify_peer == NULL) || IS_TRUE (verify_peer)) { -- 2.11.0