aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/content_encoding.c
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2022-07-12 12:03:53 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2022-07-12 12:03:53 +0300
commiteeebfbedb3ea4cab5c0aac178b683b7dd26b0bf6 (patch)
tree4783d362be8e22467d0f5eb581ce6f65e33acb04 /contrib/libs/curl/lib/content_encoding.c
parent4213b519b93b5e3d657bc362837adfea82579dcc (diff)
downloadydb-eeebfbedb3ea4cab5c0aac178b683b7dd26b0bf6.tar.gz
Update contrib/libs/curl to 7.84.0
Diffstat (limited to 'contrib/libs/curl/lib/content_encoding.c')
-rw-r--r--contrib/libs/curl/lib/content_encoding.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/libs/curl/lib/content_encoding.c b/contrib/libs/curl/lib/content_encoding.c
index 0b8bae926b..e3c7ab9b1d 100644
--- a/contrib/libs/curl/lib/content_encoding.c
+++ b/contrib/libs/curl/lib/content_encoding.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -18,6 +18,8 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
+ * SPDX-License-Identifier: curl
+ *
***************************************************************************/
#include "curl_setup.h"
@@ -1026,12 +1028,16 @@ static const struct content_encoding *find_encoding(const char *name,
return NULL;
}
+/* allow no more than 5 "chained" compression steps */
+#define MAX_ENCODE_STACK 5
+
/* Set-up the unencoding stack from the Content-Encoding header value.
* See RFC 7231 section 3.1.2.2. */
CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
const char *enclist, int maybechunked)
{
struct SingleRequest *k = &data->req;
+ int counter = 0;
do {
const char *name;
@@ -1066,6 +1072,11 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
if(!encoding)
encoding = &error_encoding; /* Defer error at stack use. */
+ if(++counter >= MAX_ENCODE_STACK) {
+ failf(data, "Reject response due to %u content encodings",
+ counter);
+ return CURLE_BAD_CONTENT_ENCODING;
+ }
/* Stack the unencoding stage. */
writer = new_unencoding_writer(data, encoding, k->writer_stack);
if(!writer)