Skip to content

Commit 4825f75

Browse files
[AUTO-CHERRYPICK] [Medium] patch c-ares to fix CVE-2024-25629 - branch main (#12529)
Co-authored-by: jykanase <v-jykanase@microsoft.com>
1 parent b1e5bc6 commit 4825f75

3 files changed

Lines changed: 40 additions & 4 deletions

File tree

SPECS/c-ares/CVE-2024-25629.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From a6c1bbf4c6f867072628e5435c337081d8907be7 Mon Sep 17 00:00:00 2001
2+
From: jykanase <v-jykanase@microsoft.com>
3+
Date: Mon, 10 Feb 2025 07:18:21 +0000
4+
Subject: [PATCH] CVE-2024-25629.patch
5+
6+
Source Link: https://github.com/c-ares/c-ares/commit/a804c04ddc8245fc8adf0e92368709639125e183
7+
---
8+
src/lib/ares__read_line.c | 8 ++++++++
9+
1 file changed, 8 insertions(+)
10+
11+
diff --git a/src/lib/ares__read_line.c b/src/lib/ares__read_line.c
12+
index c62ad2a..d6625a3 100644
13+
--- a/src/lib/ares__read_line.c
14+
+++ b/src/lib/ares__read_line.c
15+
@@ -49,6 +49,14 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
16+
if (!fgets(*buf + offset, bytestoread, fp))
17+
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
18+
len = offset + strlen(*buf + offset);
19+
+
20+
+ /* Probably means there was an embedded NULL as the first character in
21+
+ * the line, throw away line */
22+
+ if (len == 0) {
23+
+ offset = 0;
24+
+ continue;
25+
+ }
26+
+
27+
if ((*buf)[len - 1] == '\n')
28+
{
29+
(*buf)[len - 1] = 0;
30+
--
31+
2.45.2
32+

SPECS/c-ares/c-ares.spec

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
Summary: A library that performs asynchronous DNS operations
22
Name: c-ares
33
Version: 1.19.1
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
Group: System Environment/Libraries
99
URL: https://c-ares.haxx.se/
10-
Source0: https://c-ares.haxx.se/download/%{name}-%{version}.tar.gz
10+
Source0: https://github.com/c-ares/c-ares/releases/download/cares-1_19_1/%{name}-%{version}.tar.gz
1111
BuildRequires: autoconf
1212
BuildRequires: automake
1313
BuildRequires: libtool
1414

15+
Patch0: CVE-2024-25629.patch
1516
%description
1617
c-ares is a C library that performs DNS requests and name resolves
1718
asynchronously. c-ares is a fork of the library named 'ares', written
@@ -28,7 +29,7 @@ This package contains the header files and libraries needed to
2829
compile applications or shared objects that use c-ares.
2930

3031
%prep
31-
%autosetup
32+
%autosetup -p1
3233
f=CHANGES ; iconv -f iso-8859-1 -t utf-8 $f -o $f.utf8 ; mv $f.utf8 $f
3334

3435
%build
@@ -113,6 +114,9 @@ fi
113114
%{_mandir}/man3/ares_*
114115

115116
%changelog
117+
* Mon Feb 10 2025 Jyoti Kanase <v-jykanase@microsoft.com> - 1.19.1-2
118+
- Patch to fix CVE-2024-25629.
119+
116120
* Tue May 30 2023 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 1.19.1-1
117121
- Auto-upgrade to 1.19.1 - CVE-2023-32067
118122

cgmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@
14081408
"other": {
14091409
"name": "c-ares",
14101410
"version": "1.19.1",
1411-
"downloadUrl": "https://c-ares.haxx.se/download/c-ares-1.19.1.tar.gz"
1411+
"downloadUrl": "https://github.com/c-ares/c-ares/releases/download/cares-1_19_1/c-ares-1.19.1.tar.gz"
14121412
}
14131413
}
14141414
},

0 commit comments

Comments
 (0)