diff --git a/backport-Do-not-assume-PATH_MAX-is-defined.patch b/backport-Do-not-assume-PATH_MAX-is-defined.patch new file mode 100644 index 0000000000000000000000000000000000000000..c876b20f7204f749a7560a9ba1ee668d8f51419d --- /dev/null +++ b/backport-Do-not-assume-PATH_MAX-is-defined.patch @@ -0,0 +1,41 @@ +From eea6fbc196872eeca6f02fcfba298f3e1bb62880 Mon Sep 17 00:00:00 2001 +From: Guillem Jover +Date: Thu, 11 Jan 2024 02:18:07 +0100 +Subject: [PATCH] Do not assume PATH_MAX is defined + +--- + filename.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/filename.c b/filename.c +index eb6b16c..820d107 100644 +--- a/filename.c ++++ b/filename.c +@@ -830,9 +830,24 @@ lrealpath(path) + char *path; + { + #if HAVE_REALPATH ++ /* ++ * Not all systems support the POSIX.1-2008 realpath() behavior ++ * of allocating when passing a NULL argument. And PATH_MAX is ++ * not required to be defined, or might contain an exceedingly ++ * big value. We assume that if it is not defined (such as on ++ * GNU/Hurd), then realpath() accepts NULL. ++ */ ++#ifndef PATH_MAX ++ char *rpath; ++ ++ rpath = realpath(path, NULL); ++ if (rpath != NULL) ++ return (rpath); ++#else + char rpath[PATH_MAX]; + if (realpath(path, rpath) != NULL) + return (save(rpath)); ++#endif + #endif + return (save(path)); + } +-- +2.27.0 + diff --git a/less.spec b/less.spec index 56e9bae8b5f19eb9de256a5af54ee1958f5a722a..5a8799c36c7679593f477529c7dbad74b2006f65 100644 --- a/less.spec +++ b/less.spec @@ -1,6 +1,6 @@ Name: less Version: 590 -Release: 4 +Release: 5 Summary: Less is a pager that displays text files. License: GPLv3+ or BSD URL: http://www.greenwoodsoftware.com/less @@ -12,6 +12,7 @@ Patch3: backport-Shell-quote-filenames-when-invoking-LESSCLOSE.patch Patch4: backport-Some-constifying.patch Patch5: backport-Implement-osc8_open.patch Patch6: backport-CVE-2024-32487.patch +Patch7: backport-Do-not-assume-PATH_MAX-is-defined.patch BuildRequires: git gcc make ncurses-devel autoconf automake libtool @@ -50,6 +51,9 @@ autoreconf -ivf %{_mandir}/man1/* %changelog +* Fri Jun 21 2024 baiguo - 590-5 +- Do not assume PATH_MAX is defined + * Mon Apr 22 2024 wangjiang - 590-4 - fix CVE-2024-32487