Skip to content

Commit f5281d8

Browse files
authored
Merge pull request #52 from binford2k/CVE-2025-2588/patch_augeas_vuln
[CVE-2025-2588] patch augeas to return _REG_ENOSYS
2 parents 1a004e7 + 4a025e2 commit f5281d8

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

configs/components/augeas.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
case version
1010
when '1.14.1'
1111
pkg.md5sum 'ac31216268b4b64809afd3a25f2515e5'
12+
13+
pkg.apply_patch 'resources/patches/augeas/augeas-1.14.1-return_reg_enosys.patch'
1214
when '1.12.0'
1315
pkg.md5sum '74f1c7b8550f4e728486091f6b907175'
1416

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
diff --git a/src/fa.c b/src/fa.c
2+
index 66ac70784..4de5675b9 100644
3+
--- a/src/fa.c
4+
+++ b/src/fa.c
5+
@@ -3550,6 +3550,8 @@ static struct re *parse_regexp(struct re_parse *parse) {
6+
return re;
7+
8+
error:
9+
+ if (re == NULL && parse->error == REG_NOERROR)
10+
+ parse->error = _REG_ENOSYS;
11+
re_unref(re);
12+
return NULL;
13+
}
14+
diff --git a/src/fa.h b/src/fa.h
15+
index 1fd754ad0..89c9b17e9 100644
16+
--- a/src/fa.h
17+
+++ b/src/fa.h
18+
@@ -81,7 +81,8 @@ extern int fa_minimization_algorithm;
19+
*
20+
* On success, FA points to the newly allocated automaton constructed for
21+
* RE, and the function returns REG_NOERROR. Otherwise, FA is NULL, and the
22+
- * return value indicates the error.
23+
+ * return value indicates the error. Special value _REG_ENOSYS indicates
24+
+ * fa_compile() couldn't identify the syntax issue with regexp.
25+
*
26+
* The FA is case sensitive. Call FA_NOCASE to switch it to
27+
* case-insensitive.
28+
diff --git a/tests/fatest.c b/tests/fatest.c
29+
index 0c9ca7696..6717af8f4 100644
30+
--- a/tests/fatest.c
31+
+++ b/tests/fatest.c
32+
@@ -589,6 +589,7 @@ static void testExpandNoCase(CuTest *tc) {
33+
const char *p1 = "aB";
34+
const char *p2 = "[a-cUV]";
35+
const char *p3 = "[^a-z]";
36+
+ const char *wrong_regexp = "{&.{";
37+
char *s;
38+
size_t len;
39+
int r;
40+
@@ -607,6 +608,11 @@ static void testExpandNoCase(CuTest *tc) {
41+
CuAssertIntEquals(tc, 0, r);
42+
CuAssertStrEquals(tc, "[^A-Za-z]", s);
43+
free(s);
44+
+
45+
+ /* Test that fa_expand_nocase does return _REG_ENOSYS */
46+
+ r = fa_expand_nocase(wrong_regexp, strlen(wrong_regexp), &s, &len);
47+
+ CuAssertIntEquals(tc, _REG_ENOSYS, r);
48+
+ free(s);
49+
}
50+
51+
static void testNoCaseComplement(CuTest *tc) {

0 commit comments

Comments
 (0)