Skip to content

Commit f23dc6b

Browse files
authored
Merge pull request #805 from span786/PA-6145-patch-curl-cve-2023-46218
[PA-6145]: Applied Curl Patch CVE-2023-46218
2 parents cba7d57 + 885731e commit f23dc6b

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

configs/components/curl.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
pkg.apply_patch 'resources/patches/curl/CVE-2023-32001.patch'
3333
pkg.apply_patch 'resources/patches/curl/CVE-2023-38545.patch'
3434
pkg.apply_patch 'resources/patches/curl/CVE-2023-38546.patch'
35+
pkg.apply_patch 'resources/patches/curl/CVE-2023-46218.patch'
3536

3637
configure_options = []
3738
configure_options << "--with-ssl=#{settings[:prefix]}"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 2b0994c29a721c91c572cff7808c572a24d251eb Thu Nov 23 00:00:00 2023
2+
From: Daniel Stenberg <[email protected]>
3+
Date: Thu, 23 Nov 2023 23:28:32 +0200
4+
Subject: [PATCH] cookie: lowercase the domain names before PSL checks
5+
6+
Reported-by: Harry Sintonen
7+
8+
Closes #12387
9+
---
10+
diff --git a/lib/cookie.c b/lib/cookie.c
11+
index c457b2d95..fc3f2bd98 100644
12+
--- a/lib/cookie.c
13+
+++ b/lib/cookie.c
14+
@@ -1049,15 +1049,23 @@ Curl_cookie_add(struct Curl_easy *data,
15+
* dereference it.
16+
*/
17+
if(data && (domain && co->domain && !Curl_host_is_ipnum(co->domain))) {
18+
- const psl_ctx_t *psl = Curl_psl_use(data);
19+
- int acceptable;
20+
-
21+
- if(psl) {
22+
- acceptable = psl_is_cookie_domain_acceptable(psl, domain, co->domain);
23+
- Curl_psl_release(data);
24+
+ bool acceptable = FALSE;
25+
+ char lcase[256];
26+
+ char lcookie[256];
27+
+ size_t dlen = strlen(domain);
28+
+ size_t clen = strlen(co->domain);
29+
+ if((dlen < sizeof(lcase)) && (clen < sizeof(lcookie))) {
30+
+ const psl_ctx_t *psl = Curl_psl_use(data);
31+
+ if(psl) {
32+
+ /* the PSL check requires lowercase domain name and pattern */
33+
+ Curl_strntolower(lcase, domain, dlen + 1);
34+
+ Curl_strntolower(lcookie, co->domain, clen + 1);
35+
+ acceptable = psl_is_cookie_domain_acceptable(psl, lcase, lcookie);
36+
+ Curl_psl_release(data);
37+
+ }
38+
+ else
39+
+ acceptable = !bad_domain(domain, strlen(domain));
40+
}
41+
- else
42+
- acceptable = !bad_domain(domain);
43+
44+
if(!acceptable) {
45+
infof(data, "cookie '%s' dropped, domain '%s' must not "

0 commit comments

Comments
 (0)