Skip to content

Commit 2286c5b

Browse files
committed
Patch augeas for CVE-2025-2588 [MEDIUM] (#13207)
(cherry picked from commit a76e674)
1 parent 71f19a2 commit 2286c5b

2 files changed

Lines changed: 87 additions & 1 deletion

File tree

SPECS/augeas/CVE-2025-2588.patch

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From 42632cb7d0103fbf871fb698e7648ba925eec254 Mon Sep 17 00:00:00 2001
2+
From: Alexander Bokovoy <abokovoy@redhat.com>
3+
Date: Mon, 24 Mar 2025 09:48:19 +0200
4+
Subject: [PATCH] CVE-2025-2588: return _REG_ENOSYS if no specific error was
5+
set yet parse_regexp failed
6+
7+
parse_regexp() supposed to set an error on the parser state in case of a
8+
failure. If no specific error was set, return _REG_ENOSYS to indicate a
9+
generic failure.
10+
11+
Fixes: https://github.com/hercules-team/augeas/issues/671
12+
Fixes: https://github.com/hercules-team/augeas/issues/778
13+
Fixes: https://github.com/hercules-team/augeas/issues/852
14+
15+
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
16+
---
17+
src/fa.c | 3 +++
18+
src/fa.h | 3 ++-
19+
tests/fatest.c | 6 ++++++
20+
3 files changed, 11 insertions(+), 1 deletion(-)
21+
22+
diff --git a/src/fa.c b/src/fa.c
23+
index 66ac70784..14f2472ad 100644
24+
--- a/src/fa.c
25+
+++ b/src/fa.c
26+
@@ -32,6 +32,7 @@
27+
#include <config.h>
28+
#include <limits.h>
29+
#include <ctype.h>
30+
+#include <regex.h>
31+
#include <stdbool.h>
32+
33+
#include "internal.h"
34+
@@ -3550,6 +3551,8 @@ static struct re *parse_regexp(struct re_parse *parse) {
35+
return re;
36+
37+
error:
38+
+ if (re == NULL && parse->error == REG_NOERROR)
39+
+ parse->error = _REG_ENOSYS;
40+
re_unref(re);
41+
return NULL;
42+
}
43+
diff --git a/src/fa.h b/src/fa.h
44+
index 1fd754ad0..89c9b17e9 100644
45+
--- a/src/fa.h
46+
+++ b/src/fa.h
47+
@@ -81,7 +81,8 @@ extern int fa_minimization_algorithm;
48+
*
49+
* On success, FA points to the newly allocated automaton constructed for
50+
* RE, and the function returns REG_NOERROR. Otherwise, FA is NULL, and the
51+
- * return value indicates the error.
52+
+ * return value indicates the error. Special value _REG_ENOSYS indicates
53+
+ * fa_compile() couldn't identify the syntax issue with regexp.
54+
*
55+
* The FA is case sensitive. Call FA_NOCASE to switch it to
56+
* case-insensitive.
57+
diff --git a/tests/fatest.c b/tests/fatest.c
58+
index 0c9ca7696..6717af8f4 100644
59+
--- a/tests/fatest.c
60+
+++ b/tests/fatest.c
61+
@@ -589,6 +589,7 @@ static void testExpandNoCase(CuTest *tc) {
62+
const char *p1 = "aB";
63+
const char *p2 = "[a-cUV]";
64+
const char *p3 = "[^a-z]";
65+
+ const char *wrong_regexp = "{&.{";
66+
char *s;
67+
size_t len;
68+
int r;
69+
@@ -607,6 +608,11 @@ static void testExpandNoCase(CuTest *tc) {
70+
CuAssertIntEquals(tc, 0, r);
71+
CuAssertStrEquals(tc, "[^A-Za-z]", s);
72+
free(s);
73+
+
74+
+ /* Test that fa_expand_nocase does return _REG_ENOSYS */
75+
+ r = fa_expand_nocase(wrong_regexp, strlen(wrong_regexp), &s, &len);
76+
+ CuAssertIntEquals(tc, _REG_ENOSYS, r);
77+
+ free(s);
78+
}
79+
80+
static void testNoCaseComplement(CuTest *tc) {

SPECS/augeas/augeas.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
Summary: A library for changing configuration files
22
Name: augeas
33
Version: 1.12.0
4-
Release: 5%{?dist}
4+
Release: 6%{?dist}
55
License: LGPLv2+
66
Vendor: Microsoft Corporation
77
Distribution: Mariner
88
URL: https://augeas.net/
99
Source0: http://download.augeas.net/%{name}-%{version}.tar.gz
1010

11+
Patch0: CVE-2025-2588.patch
12+
1113
BuildRequires: gcc
1214
BuildRequires: libselinux-devel
1315
BuildRequires: libxml2-devel
@@ -50,6 +52,7 @@ read files.
5052

5153
%prep
5254
%setup -q
55+
%autopatch -p1
5356

5457
%build
5558
%configure \
@@ -106,6 +109,9 @@ rm -f %{buildroot}%{_bindir}/dump
106109
%{_libdir}/pkgconfig/augeas.pc
107110

108111
%changelog
112+
* Sun Mar 30 2025 Kshitiz Godara <kgodara@microsoft.com> - 1.12.0-6
113+
- Fix CVE-2025-2588 with an upstream patch
114+
109115
* Wed Sep 20 2023 Jon Slobodzian <joslobo@microsoft.com> - 1.12.0-5
110116
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)
111117

0 commit comments

Comments
 (0)