diff --git a/backport-Fix-crash-when-enter-invaid-pattern-in-command.patch b/backport-Fix-crash-when-enter-invaid-pattern-in-command.patch new file mode 100644 index 0000000000000000000000000000000000000000..a531631967feb4b240c4571c6de1bce8f7ed08c2 --- /dev/null +++ b/backport-Fix-crash-when-enter-invaid-pattern-in-command.patch @@ -0,0 +1,29 @@ +From 74c598dd717de5e00db3d4995ee23d01f3510516 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sun, 15 Aug 2021 17:38:21 -0700 +Subject: [PATCH] Fix crash when enter invaid pattern in & command. + +--- + search.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/search.c b/search.c +index f619fbe..4cc6832 100644 +--- a/search.c ++++ b/search.c +@@ -1908,7 +1908,11 @@ set_filter_pattern(pattern, search_type) + /* Create a new filter and add it to the filter_infos list. */ + filter = ecalloc(1, sizeof(struct pattern_info)); + init_pattern(filter); +- set_pattern(filter, pattern, search_type, 1); ++ if (set_pattern(filter, pattern, search_type, 1) < 0) ++ { ++ free(filter); ++ return; ++ } + filter->next = filter_infos; + filter_infos = filter; + } +-- +2.27.0 + diff --git a/backport-Fix-memory-leak-when-using-corrupt-lesshst-file.patch b/backport-Fix-memory-leak-when-using-corrupt-lesshst-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..972d7127a94e75cff2dc935a90ebe685185220af --- /dev/null +++ b/backport-Fix-memory-leak-when-using-corrupt-lesshst-file.patch @@ -0,0 +1,26 @@ +From 1974e5f8cd628e5fc1075883f3eba3e5390860d3 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman +Date: Sat, 9 Oct 2021 18:15:58 -0700 +Subject: [PATCH] Fix memory leak when using corrupt lesshst file. + +--- + mark.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mark.c b/mark.c +index cbb316f..6506683 100644 +--- a/mark.c ++++ b/mark.c +@@ -59,6 +59,9 @@ cmark(m, ifile, pos, ln) + m->m_ifile = ifile; + m->m_scrpos.pos = pos; + m->m_scrpos.ln = ln; ++ if (m->m_filename != NULL) ++ /* Normally should not happen but a corrupt lesshst file can do it. */ ++ free(m->m_filename); + m->m_filename = NULL; + } + +-- +2.27.0 + diff --git a/less.spec b/less.spec index fbd02d4ef8a81e8bd9988359ebd35f77af4b0bf3..4ca58194d694f736efc289e2c2d10301a132ccee 100644 --- a/less.spec +++ b/less.spec @@ -1,11 +1,13 @@ Name: less Version: 590 -Release: 2 +Release: 3 Summary: Less is a pager that displays text files. License: GPLv3+ or BSD URL: http://www.greenwoodsoftware.com/less Source0: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz -Patch0: less-394-time.patch +Patch0: less-394-time.patch +Patch6000: backport-Fix-memory-leak-when-using-corrupt-lesshst-file.patch +Patch6001: backport-Fix-crash-when-enter-invaid-pattern-in-command.patch BuildRequires: gcc make ncurses-devel autoconf automake libtool @@ -44,6 +46,14 @@ autoreconf -ivf %{_mandir}/man1/* %changelog +* Fri Dec 9 2022 Eibz-Chan - 590-3 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:[add] backport patches from upstream + Fix-memory-leak-when-using-corrupt-lesshst-file.patch + Fix-crash-when-enter-invaid-pattern-in-command.patch + * Thu Oct 13 2022 fuanan - 590-2 - DESC:fix the changelog exception macro