From 683c7a8e47e829abd0f567a3fc6e46df0d3f215e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Wed, 11 Dec 2024 10:32:29 +0100 Subject: [PATCH] avoid a leak when linter aborts after producing parsable output Resolves: RHEL-51175 --- ...-5.6.1-fix-leak-after-linter-failure.patch | 35 +++++++++++++++++++ nano.spec | 7 +++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 nano-5.6.1-fix-leak-after-linter-failure.patch diff --git a/nano-5.6.1-fix-leak-after-linter-failure.patch b/nano-5.6.1-fix-leak-after-linter-failure.patch new file mode 100644 index 0000000..51279ef --- /dev/null +++ b/nano-5.6.1-fix-leak-after-linter-failure.patch @@ -0,0 +1,35 @@ +From 7fd38e88c12133859f48ca3191fe341795401982 Mon Sep 17 00:00:00 2001 +From: Lukáš Zaoral +Date: Tue, 10 Dec 2024 10:01:07 +0100 +Subject: memory: avoid a leak when linter aborts after producing parsable + output + +Any collected messages should be freed also after an +abnormal exit of the linter. + +Buglet existed since version 2.4.1, commit f225991b. +--- + src/text.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/text.c b/src/text.c +index e924e818..5ac9d4ca 100644 +--- a/src/text.c ++++ b/src/text.c +@@ -2755,6 +2755,13 @@ void do_linter(void) + + if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) { + statusline(ALERT, _("Error invoking '%s'"), openfile->syntax->linter); ++ for (curlint = lints; curlint != NULL;) { ++ tmplint = curlint; ++ curlint = curlint->next; ++ free(tmplint->msg); ++ free(tmplint->filename); ++ free(tmplint); ++ } + return; + } + +-- +cgit v1.2.3-70-g09d2 + diff --git a/nano.spec b/nano.spec index 3a405ec..9ef6fd8 100644 --- a/nano.spec +++ b/nano.spec @@ -8,7 +8,7 @@ Summary: A small text editor Name: nano Version: 5.6.1 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ URL: https://www.nano-editor.org Source: https://www.nano-editor.org/dist/latest/%{name}-%{version}.tar.xz @@ -21,6 +21,8 @@ Source13: nano-default-editor.fish # fix emergency file replacement vulnerability (CVE-2024-5742) Patch0: nano-5.6.1-emergency-file-replace-vuln.patch +# avoid a leak when linter aborts after producing parsable output (RHEL-51175) +Patch1: nano-5.6.1-fix-leak-after-linter-failure.patch BuildRequires: file-devel BuildRequires: gettext-devel @@ -112,6 +114,9 @@ install -Dpm 0644 %{SOURCE13} %{buildroot}%{_datadir}/fish/vendor_conf.d/%{basen %changelog +* Wed Dec 11 2024 Lukáš Zaoral - 5.6.1-7 +- avoid a leak when linter aborts after producing parsable output (RHEL-51175) + * Mon Jul 01 2024 Lukáš Zaoral - 5.6.1-6 - fix emergency file replacement vulnerability (RHEL-35237)