diff options
Diffstat (limited to 'meta/recipes-support/curl/curl/CVE-2023-46218.patch')
-rw-r--r-- | meta/recipes-support/curl/curl/CVE-2023-46218.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-support/curl/curl/CVE-2023-46218.patch b/meta/recipes-support/curl/curl/CVE-2023-46218.patch new file mode 100644 index 0000000000..c9677b6a84 --- /dev/null +++ b/meta/recipes-support/curl/curl/CVE-2023-46218.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | CVE: CVE-2023-46218 | ||
2 | Upstream-Status: Backport [ import from ubuntu http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.68.0-1ubuntu2.21.debian.tar.xz upstream https://github.com/curl/curl/commit/2b0994c29a721c91c57 ] | ||
3 | Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> | ||
4 | |||
5 | Backport of: | ||
6 | |||
7 | From 2b0994c29a721c91c572cff7808c572a24d251eb Mon Sep 17 00:00:00 2001 | ||
8 | From: Daniel Stenberg <daniel@haxx.se> | ||
9 | Date: Thu, 23 Nov 2023 08:15:47 +0100 | ||
10 | Subject: [PATCH] cookie: lowercase the domain names before PSL checks | ||
11 | |||
12 | Reported-by: Harry Sintonen | ||
13 | |||
14 | Closes #12387 | ||
15 | --- | ||
16 | lib/cookie.c | 24 ++++++++++++++++-------- | ||
17 | 1 file changed, 16 insertions(+), 8 deletions(-) | ||
18 | |||
19 | --- a/lib/cookie.c | ||
20 | +++ b/lib/cookie.c | ||
21 | @@ -967,15 +967,23 @@ Curl_cookie_add(struct Curl_easy *data, | ||
22 | #ifdef USE_LIBPSL | ||
23 | /* Check if the domain is a Public Suffix and if yes, ignore the cookie. */ | ||
24 | if(domain && co->domain && !isip(co->domain)) { | ||
25 | - const psl_ctx_t *psl = Curl_psl_use(data); | ||
26 | - int acceptable; | ||
27 | - | ||
28 | - if(psl) { | ||
29 | - acceptable = psl_is_cookie_domain_acceptable(psl, domain, co->domain); | ||
30 | - Curl_psl_release(data); | ||
31 | + bool acceptable = FALSE; | ||
32 | + char lcase[256]; | ||
33 | + char lcookie[256]; | ||
34 | + size_t dlen = strlen(domain); | ||
35 | + size_t clen = strlen(co->domain); | ||
36 | + if((dlen < sizeof(lcase)) && (clen < sizeof(lcookie))) { | ||
37 | + const psl_ctx_t *psl = Curl_psl_use(data); | ||
38 | + if(psl) { | ||
39 | + /* the PSL check requires lowercase domain name and pattern */ | ||
40 | + Curl_strntolower(lcase, domain, dlen + 1); | ||
41 | + Curl_strntolower(lcookie, co->domain, clen + 1); | ||
42 | + acceptable = psl_is_cookie_domain_acceptable(psl, lcase, lcookie); | ||
43 | + Curl_psl_release(data); | ||
44 | + } | ||
45 | + else | ||
46 | + acceptable = !bad_domain(domain); | ||
47 | } | ||
48 | - else | ||
49 | - acceptable = !bad_domain(domain); | ||
50 | |||
51 | if(!acceptable) { | ||
52 | infof(data, "cookie '%s' dropped, domain '%s' must not " | ||