diff --git a/CVE-2024-53849.patch b/CVE-2024-53849.patch new file mode 100644 index 0000000000000000000000000000000000000000..4bca4d09d113756abdb93b8a53029e7a6b39708d --- /dev/null +++ b/CVE-2024-53849.patch @@ -0,0 +1,60 @@ +From 77d657c6072da8a46333dc31fbe27cf3d0d8fa00 Mon Sep 17 00:00:00 2001 +From: xuhdev +Date: Feb 19, 2024 15:20:09 +0800 +Subject: [PATCH] CVE-2024-53849 + +--- + src/lib/ec_glob.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/lib/ec_glob.c b/src/lib/ec_glob.c +index ea62aee..b916012 100644 +--- a/src/lib/ec_glob.c ++++ b/src/lib/ec_glob.c +@@ -27,6 +27,7 @@ + + #include "global.h" + ++#include + #include + #include + #include +@@ -51,7 +52,8 @@ static const UT_icd ut_int_pair_icd = {sizeof(int_pair),NULL,NULL,NULL}; + /* concatenate the string then move the pointer to the end */ + #define STRING_CAT(p, string, end) do { \ + size_t string_len = strlen(string); \ +- if (p + string_len >= end) \ ++ assert(end > p); \ ++ if (string_len >= (size_t)(end - p)) \ + return -1; \ + strcat(p, string); \ + p += string_len; \ +@@ -192,10 +194,14 @@ int ec_glob(const char *pattern, const char *string) + if (!right_bracket) /* The right bracket may not exist */ + right_bracket = c + strlen(c); + +- strcat(p_pcre, "\\"); ++ STRING_CAT(p_pcre, "\\", pcre_str_end); ++ /* Boundary check for strncat below. */ ++ if (pcre_str_end - p_pcre <= right_bracket - c) { ++ return -1; ++ } + strncat(p_pcre, c, right_bracket - c); + if (*right_bracket) /* right_bracket is a bracket */ +- strcat(p_pcre, "\\]"); ++ STRING_CAT(p_pcre, "\\]", pcre_str_end); + p_pcre += strlen(p_pcre); + c = right_bracket; + if (!*c) +@@ -339,7 +345,7 @@ int ec_glob(const char *pattern, const char *string) + } + } + +- *(p_pcre ++) = '$'; ++ ADD_CHAR(p_pcre, '$', pcre_str_end); + + pcre2_code_free(re); /* ^\\d+\\.\\.\\d+$ */ + +-- +2.48.1 + diff --git a/editorconfig.spec b/editorconfig.spec index 228a0971359e53749ee08e118f758df9f800c151..b6ed1f7b8fdf1fa1532c9d4b359568b4cd2b4fa7 100644 --- a/editorconfig.spec +++ b/editorconfig.spec @@ -5,10 +5,11 @@ Name: editorconfig Summary: Parser for EditorConfig files written in C Version: 0.12.6 -Release: 1 +Release: 2 License: BSD URL: https://github.com/editorconfig/editorconfig-core-c Source0: %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz +Patch0: CVE-2024-53849.patch BuildRequires: cmake doxygen gcc pcre2-devel @@ -79,6 +80,9 @@ rm %{buildroot}/%{_libdir}/libeditorconfig_static.a %changelog +* Mon Jun 16 2025 lvfei - 0.12.6-2 +- fix CVE-2024-53849 + * Thu Nov 23 2023 zhangxianting - 0.12.6-1 - update to version 0.12.6