diff options
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2022-32206.patch')
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2022-32206.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2022-32206.patch b/meta/recipes-support/curl/curl/CVE-2022-32206.patch new file mode 100644 index 0000000000..3d76aeb43d --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2022-32206.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From 25e7be39be5f8ed696b6085ced9cf6c17e6128f4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Daniel Stenberg <daniel@haxx.se> | ||
3 | Date: Mon, 16 May 2022 16:28:13 +0200 | ||
4 | Subject: [PATCH] content_encoding: return error on too many compression steps | ||
5 | |||
6 | The max allowed steps is arbitrarily set to 5. | ||
7 | |||
8 | Bug: https://curl.se/docs/CVE-2022-32206.html | ||
9 | CVE-2022-32206 | ||
10 | Reported-by: Harry Sintonen | ||
11 | Closes #9049 | ||
12 | |||
13 | Upstream-Status: Backport [https://github.com/curl/curl/commit/3a09fbb7f264c67c43] | ||
14 | Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org> | ||
15 | --- | ||
16 | lib/content_encoding.c | 9 +++++++++ | ||
17 | 1 file changed, 9 insertions(+) | ||
18 | |||
19 | diff --git a/lib/content_encoding.c b/lib/content_encoding.c | ||
20 | index 6d47537..91e621f 100644 | ||
21 | --- a/lib/content_encoding.c | ||
22 | +++ b/lib/content_encoding.c | ||
23 | @@ -934,6 +934,9 @@ static const content_encoding *find_encoding(const char *name, size_t len) | ||
24 | return NULL; | ||
25 | } | ||
26 | |||
27 | +/* allow no more than 5 "chained" compression steps */ | ||
28 | +#define MAX_ENCODE_STACK 5 | ||
29 | + | ||
30 | /* Set-up the unencoding stack from the Content-Encoding header value. | ||
31 | * See RFC 7231 section 3.1.2.2. */ | ||
32 | CURLcode Curl_build_unencoding_stack(struct connectdata *conn, | ||
33 | @@ -941,6 +944,7 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn, | ||
34 | { | ||
35 | struct Curl_easy *data = conn->data; | ||
36 | struct SingleRequest *k = &data->req; | ||
37 | + int counter = 0; | ||
38 | |||
39 | do { | ||
40 | const char *name; | ||
41 | @@ -975,6 +979,11 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn, | ||
42 | if(!encoding) | ||
43 | encoding = &error_encoding; /* Defer error at stack use. */ | ||
44 | |||
45 | + if(++counter >= MAX_ENCODE_STACK) { | ||
46 | + failf(data, "Reject response due to %u content encodings", | ||
47 | + counter); | ||
48 | + return CURLE_BAD_CONTENT_ENCODING; | ||
49 | + } | ||
50 | /* Stack the unencoding stage. */ | ||
51 | writer = new_unencoding_writer(conn, encoding, k->writer_stack); | ||
52 | if(!writer) | ||