Skip to content

Commit fff8063

Browse files
[AUTO-CHERRYPICK] [Medium] patch mysql to fix CVE-2024-9681 - branch main (#12156)
Co-authored-by: jykanase <v-jykanase@microsoft.com>
1 parent a488e3d commit fff8063

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

SPECS/mysql/CVE-2024-9681.patch

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 2f9a68a817e71e9ec40a2fc17269eb9367aa520a Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Sun, 26 Jan 2025 14:06:42 +0000
4+
Subject: [PATCH] CVE-2024-9681
5+
6+
Backported form: https://github.com/curl/curl/commit/a94973805df96269bf
7+
---
8+
extra/curl/curl-8.9.1/lib/hsts.c | 14 ++++++++++----
9+
1 file changed, 10 insertions(+), 4 deletions(-)
10+
11+
diff --git a/extra/curl/curl-8.9.1/lib/hsts.c b/extra/curl/curl-8.9.1/lib/hsts.c
12+
index 8cd77ae3..6e2599b1 100644
13+
--- a/extra/curl/curl-8.9.1/lib/hsts.c
14+
+++ b/extra/curl/curl-8.9.1/lib/hsts.c
15+
@@ -249,12 +249,14 @@ 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+
char buffer[MAX_HSTS_HOSTLEN + 1];
22+
time_t now = time(NULL);
23+
size_t hlen = strlen(hostname);
24+
struct Curl_llist_element *e;
25+
struct Curl_llist_element *n;
26+
+ size_t blen = 0;
27+
28+
if((hlen > MAX_HSTS_HOSTLEN) || !hlen)
29+
return NULL;
30+
@@ -279,15 +281,19 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
31+
if(ntail < hlen) {
32+
size_t offs = hlen - ntail;
33+
if((hostname[offs-1] == '.') &&
34+
- strncasecompare(&hostname[offs], sts->host, ntail))
35+
- return sts;
36+
+ strncasecompare(&hostname[offs], sts->host, ntail) &&
37+
+ (ntail > blen)) {
38+
+ /* save the tail match with the longest tail */
39+
+ bestsub = sts;
40+
+ blen = ntail;
41+
+ }
42+
}
43+
}
44+
if(strcasecompare(hostname, sts->host))
45+
return sts;
46+
}
47+
}
48+
- return NULL; /* no match */
49+
+ return bestsub;
50+
}
51+
52+
/*
53+
@@ -439,7 +445,7 @@ static CURLcode hsts_add(struct hsts *h, char *line)
54+
e = Curl_hsts(h, p, subdomain);
55+
if(!e)
56+
result = hsts_create(h, p, subdomain, expires);
57+
- else {
58+
+ else if(strcasecompare(p, e->host)) {
59+
/* the same hostname, use the largest expire time */
60+
if(expires > e->expires)
61+
e->expires = expires;
62+
--
63+
2.45.2
64+

SPECS/mysql/mysql.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: MySQL.
22
Name: mysql
33
Version: 8.0.40
4-
Release: 2%{?dist}
4+
Release: 3%{?dist}
55
License: GPLv2 with exceptions AND LGPLv2 AND BSD
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
@@ -15,6 +15,7 @@ Patch1: CVE-2024-2410.patch
1515
# AZL's OpenSSL builds with the "no-chacha" option making all ChaCha
1616
# ciphers unavailable.
1717
Patch2: fix-tests-for-unsupported-chacha-ciphers.patch
18+
Patch3: CVE-2024-9681.patch
1819
BuildRequires: cmake
1920
BuildRequires: libtirpc-devel
2021
BuildRequires: openssl-devel
@@ -114,6 +115,9 @@ fi
114115
%{_libdir}/pkgconfig/mysqlclient.pc
115116

116117
%changelog
118+
* Thu Jan 30 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 8.0.40-3
119+
- Fix CVE-2024-9681
120+
117121
* Tue Oct 29 2024 Pawel Winogrodzki <pawelwi@microsoft.com> - 8.0.40-2
118122
- Patched CVE-2024-2410.
119123

0 commit comments

Comments
 (0)