Skip to content

Commit 20f12b2

Browse files
[AUTO-CHERRYPICK] Patch CVE-2024-24806 in libuv - branch main (#8148)
Co-authored-by: suresh-thelkar <suresh.thelkar@yahoo.com>
1 parent e65e9f1 commit 20f12b2

2 files changed

Lines changed: 59 additions & 2 deletions

File tree

SPECS/libuv/CVE-2024-24806.patch

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 2c127bf21e7c76e783944b3aae974167099cbad3 Mon Sep 17 00:00:00 2001
2+
From: Suresh Thelkar <sthelkar@microsoft.com>
3+
Date: Mon, 19 Feb 2024 10:08:20 +0530
4+
Subject: [PATCH] Patch for CVE-2024-24806
5+
6+
Upstream patch details are given below
7+
https://github.com/libuv/libuv/commit/0f2d7e784a256b54b2385043438848047bc2a629
8+
---
9+
src/idna.c | 5 +++--
10+
test/test-idna.c | 4 ++++
11+
2 files changed, 7 insertions(+), 2 deletions(-)
12+
13+
diff --git a/src/idna.c b/src/idna.c
14+
index b44cb16..9526f85 100644
15+
--- a/src/idna.c
16+
+++ b/src/idna.c
17+
@@ -307,8 +307,9 @@ long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {
18+
return rc;
19+
}
20+
21+
- if (d < de)
22+
- *d++ = '\0';
23+
+ if (d >= de)
24+
+ return UV_EINVAL;
25+
26+
+ *d++ = '\0';
27+
return d - ds; /* Number of bytes written. */
28+
}
29+
diff --git a/test/test-idna.c b/test/test-idna.c
30+
index f4fad96..d079be5 100644
31+
--- a/test/test-idna.c
32+
+++ b/test/test-idna.c
33+
@@ -99,6 +99,7 @@ TEST_IMPL(utf8_decode1) {
34+
TEST_IMPL(utf8_decode1_overrun) {
35+
const char* p;
36+
char b[1];
37+
+ char c[1];
38+
39+
/* Single byte. */
40+
p = b;
41+
@@ -112,6 +113,9 @@ TEST_IMPL(utf8_decode1_overrun) {
42+
ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));
43+
ASSERT_EQ(p, b + 1);
44+
45+
+ b[0] = 0x7F;
46+
+ ASSERT_EQ(UV_EINVAL, uv__idna_toascii(b, b + 1, c, c + 1));
47+
+
48+
return 0;
49+
}
50+
51+
--
52+
2.34.1
53+

SPECS/libuv/libuv.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Summary: Cross-platform asynchronous I/O
22
Name: libuv
33
Version: 1.43.0
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: MIT AND CC-BY
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
Group: Applications/System
99
URL: https://libuv.org/
1010
Source0: https://dist.libuv.org/dist/v%{version}/%{name}-v%{version}.tar.gz
11+
Patch0: CVE-2024-24806.patch
1112
BuildRequires: build-essential
1213
BuildRequires: coreutils
1314
%if %{with_check}
@@ -35,7 +36,7 @@ Group: Development/Libraries
3536
%{summary}.
3637

3738
%prep
38-
%setup -q -n %{name}-v%{version}
39+
%autosetup -p1 -n %{name}-v%{version}
3940

4041
%build
4142
./autogen.sh
@@ -75,6 +76,9 @@ sudo -u test make -k check
7576
%{_libdir}/%{name}.a
7677

7778
%changelog
79+
* Mon Feb 19 2024 Suresh Thelkar <sthelkar@microsoft.com> - 1.43.0-2
80+
- Patch for CVE-2024-24806
81+
7882
* Tue Jan 25 2022 Henry Li <lihl@microsoft.com> - 1.43.0-1
7983
- Upgrade to version 1.43.0
8084
- License Verified

0 commit comments

Comments
 (0)