Skip to content

Commit e1055df

Browse files
jykanasesameluchjslobodzian
authored
[Medium] Patch mysql to fix CVE-2024-9681 (#12108)
Co-authored-by: Sam Meluch <[email protected]> Co-authored-by: jslobodzian <[email protected]>
1 parent 02323ba commit e1055df

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

SPECS/mysql/CVE-2024-9681.patch

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 4584d3ab388a83e2e0753c69437df975b4a13547 Mon Sep 17 00:00:00 2001
2+
From: jykanase <[email protected]>
3+
Date: Sat, 25 Jan 2025 13:44:11 +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

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: MySQL.
44
Name: mysql
55
Version: 8.0.40
6-
Release: 4%{?dist}
6+
Release: 5%{?dist}
77
License: GPLv2 with exceptions AND LGPLv2 AND BSD
88
Vendor: Microsoft Corporation
99
Distribution: Azure Linux
@@ -15,6 +15,7 @@ Patch0: CVE-2012-5627.nopatch
1515
# ciphers unavailable.
1616
Patch1: fix-tests-for-unsupported-chacha-ciphers.patch
1717
Patch2: CVE-2012-2677.patch
18+
Patch3: CVE-2024-9681.patch
1819
BuildRequires: cmake
1920
BuildRequires: libtirpc-devel
2021
BuildRequires: openssl-devel
@@ -108,6 +109,9 @@ sudo -u test make test || { cat Testing/Temporary/LastTest.log; false; }
108109
%{_libdir}/pkgconfig/mysqlclient.pc
109110

110111
%changelog
112+
* Mon Jan 27 2025 Jyoti Kanase <[email protected]> - 8.0.40-5
113+
- Fix CVE-2024-9681
114+
111115
* Tue Nov 12 2024 Pawel Winogrodzki <[email protected]> - 8.0.40-4
112116
- Patched CVE-2012-2677.
113117

0 commit comments

Comments
 (0)