Skip to content

Commit 916fdd1

Browse files
[AUTO-CHERRYPICK] [Medium] Patch cmake to fix CVE-2024-9681 - branch main (#12100)
Co-authored-by: jykanase <v-jykanase@microsoft.com>
1 parent 9fd0382 commit 916fdd1

4 files changed

Lines changed: 72 additions & 5 deletions

File tree

SPECS/cmake/CVE-2024-9681.patch

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From 35badf22978cf2ead330d9cce3c2ddb825184b48 Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Wed, 22 Jan 2025 10:42:04 +0000
4+
Subject: [PATCH] CVE-2024-9681.patch
5+
6+
Backported form: https://github.com/curl/curl/commit/a94973805df96269bf3f3bf0a20ccb9887313316
7+
---
8+
Utilities/cmcurl/lib/hsts.c | 14 ++++++++++----
9+
1 file changed, 10 insertions(+), 4 deletions(-)
10+
11+
diff --git a/Utilities/cmcurl/lib/hsts.c b/Utilities/cmcurl/lib/hsts.c
12+
index 97a07ec4..bd2b3ce7 100644
13+
--- a/Utilities/cmcurl/lib/hsts.c
14+
+++ b/Utilities/cmcurl/lib/hsts.c
15+
@@ -232,11 +232,13 @@ CURLcode Curl_hsts_parse(struct hsts *h, const char *hostname,
16+
struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
17+
bool subdomain)
18+
{
19+
+ struct stsentry *bestsub = NULL;
20+
if(h) {
21+
time_t now = time(NULL);
22+
size_t hlen = strlen(hostname);
23+
struct Curl_llist_element *e;
24+
struct Curl_llist_element *n;
25+
+ size_t blen = 0;
26+
for(e = h->list.head; e; e = n) {
27+
struct stsentry *sts = e->ptr;
28+
n = e->next;
29+
@@ -251,15 +253,19 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
30+
if(ntail < hlen) {
31+
size_t offs = hlen - ntail;
32+
if((hostname[offs-1] == '.') &&
33+
- Curl_strncasecompare(&hostname[offs], sts->host, ntail))
34+
- return sts;
35+
+ Curl_strncasecompare(&hostname[offs], sts->host, ntail) &&
36+
+ (ntail > blen)) {
37+
+ /* save the tail match with the longest tail */
38+
+ bestsub = sts;
39+
+ blen = ntail;
40+
+ }
41+
}
42+
}
43+
if(Curl_strcasecompare(hostname, sts->host))
44+
return sts;
45+
}
46+
}
47+
- return NULL; /* no match */
48+
+ return bestsub;
49+
}
50+
51+
/*
52+
@@ -412,7 +418,7 @@ static CURLcode hsts_add(struct hsts *h, char *line)
53+
e = Curl_hsts(h, p, subdomain);
54+
if(!e)
55+
result = hsts_create(h, p, subdomain, expires);
56+
- else {
57+
+ else if(strcasecompare(p, e->host)) {
58+
/* the same host name, use the largest expire time */
59+
if(expires > e->expires)
60+
e->expires = expires;
61+
--
62+
2.45.2
63+

SPECS/cmake/cmake.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: Cmake
33
Name: cmake
44
Version: 3.21.4
5-
Release: 15%{?dist}
5+
Release: 16%{?dist}
66
License: BSD AND LGPLv2+
77
Vendor: Microsoft Corporation
88
Distribution: Mariner
@@ -33,6 +33,7 @@ Patch18: CVE-2024-2398.patch
3333
Patch19: CVE-2024-28182.patch
3434
Patch20: CVE-2024-7264.patch
3535
Patch21: CVE-2024-11053.patch
36+
Patch22: CVE-2024-9681.patch
3637
BuildRequires: bzip2
3738
BuildRequires: bzip2-devel
3839
BuildRequires: curl
@@ -98,6 +99,9 @@ bin/ctest --force-new-ctest-process --rerun-failed --output-on-failure
9899
%{_prefix}/doc/%{name}-*/*
99100

100101
%changelog
102+
* Thu Jan 23 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 3.21.4-16
103+
- Fix CVE-2024-9681
104+
101105
* Tue Jan 14 2025 Henry Beberman <henry.beberman@microsoft.com> - 3.21.4-15
102106
- Patch vendored curl for CVE-2024-11053
103107

toolkit/resources/manifests/package/toolchain_aarch64.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ check-debuginfo-0.15.2-1.cm2.aarch64.rpm
3030
chkconfig-1.20-4.cm2.aarch64.rpm
3131
chkconfig-debuginfo-1.20-4.cm2.aarch64.rpm
3232
chkconfig-lang-1.20-4.cm2.aarch64.rpm
33-
cmake-3.21.4-15.cm2.aarch64.rpm
34-
cmake-debuginfo-3.21.4-15.cm2.aarch64.rpm
33+
cmake-3.21.4-16.cm2.aarch64.rpm
34+
cmake-debuginfo-3.21.4-16.cm2.aarch64.rpm
3535
coreutils-8.32-7.cm2.aarch64.rpm
3636
coreutils-debuginfo-8.32-7.cm2.aarch64.rpm
3737
coreutils-lang-8.32-7.cm2.aarch64.rpm

toolkit/resources/manifests/package/toolchain_x86_64.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ check-debuginfo-0.15.2-1.cm2.x86_64.rpm
3131
chkconfig-1.20-4.cm2.x86_64.rpm
3232
chkconfig-debuginfo-1.20-4.cm2.x86_64.rpm
3333
chkconfig-lang-1.20-4.cm2.x86_64.rpm
34-
cmake-3.21.4-15.cm2.x86_64.rpm
35-
cmake-debuginfo-3.21.4-15.cm2.x86_64.rpm
34+
cmake-3.21.4-16.cm2.x86_64.rpm
35+
cmake-debuginfo-3.21.4-16.cm2.x86_64.rpm
3636
coreutils-8.32-7.cm2.x86_64.rpm
3737
coreutils-debuginfo-8.32-7.cm2.x86_64.rpm
3838
coreutils-lang-8.32-7.cm2.x86_64.rpm

0 commit comments

Comments
 (0)