Skip to content

Commit 1a3b9da

Browse files
yogi-uakuster
authored andcommitted
c-ares: fix CVE-2024-25629
c-ares is a C library for asynchronous DNS requests. `ares__read_line()` is used to parse local configuration files such as `/etc/resolv.conf`, `/etc/nsswitch.conf`, the `HOSTALIASES` file, and if using a c-ares version prior to 1.27.0, the `/etc/hosts` file. If any of these configuration files has an embedded `NULL` character as the first character in a new line, it can lead to attempting to read memory prior to the start of the given buffer which may result in a crash. This issue is fixed in c-ares 1.27.0. No known workarounds exist. References: https://nvd.nist.gov/vuln/detail/CVE-2024-25629 GHSA-mg26-v6qh-x48q https://security-tracker.debian.org/tracker/CVE-2024-25629 Signed-off-by: Yogita Urade <yogita.urade@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
1 parent da98a75 commit 1a3b9da

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From: a804c04ddc8245fc8adf0e92368709639125e183 Mon Sep 17 00:00:00 2001
2+
From: Brad House <brad@brad-house.com>
3+
Date: Mon, 11 Mar 2024 14:29:39 +0000
4+
Subject: [PATCH] Merge pull request from GHSA-mg26-v6qh-x48q
5+
6+
CVE: CVE-2024-25629
7+
Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/a804c04ddc8245fc8adf0e92368709639125e183]
8+
9+
Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
10+
---
11+
src/lib/ares__read_line.c | 8 ++++++++
12+
1 file changed, 8 insertions(+)
13+
14+
diff --git a/src/lib/ares__read_line.c b/src/lib/ares__read_line.c
15+
index c62ad2a..d6625a3 100644
16+
--- a/src/lib/ares__read_line.c
17+
+++ b/src/lib/ares__read_line.c
18+
@@ -49,6 +49,14 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
19+
if (!fgets(*buf + offset, bytestoread, fp))
20+
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
21+
len = offset + strlen(*buf + offset);
22+
+
23+
+ /* Probably means there was an embedded NULL as the first character in
24+
+ * the line, throw away line */
25+
+ if (len == 0) {
26+
+ offset = 0;
27+
+ continue;
28+
+ }
29+
+
30+
if ((*buf)[len - 1] == '\n')
31+
{
32+
(*buf)[len - 1] = 0;
33+
--
34+
2.40.0

meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
1010
file://CVE-2023-31130.patch \
1111
file://CVE-2023-32067.patch \
1212
file://CVE-2023-31147.patch \
13+
file://CVE-2024-25629.patch \
1314
"
1415
SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
1516

0 commit comments

Comments
 (0)