Do not assume PATH_MAX is defined
This commit is contained in:
parent
2f74f04b38
commit
d9d110d0b1
41
backport-Do-not-assume-PATH_MAX-is-defined.patch
Normal file
41
backport-Do-not-assume-PATH_MAX-is-defined.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From eea6fbc196872eeca6f02fcfba298f3e1bb62880 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Guillem Jover <guillem@hadrons.org>
|
||||||
|
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 f910aa5..c6bc49e 100644
|
||||||
|
--- a/filename.c
|
||||||
|
+++ b/filename.c
|
||||||
|
@@ -812,9 +812,24 @@ public char * lrealpath(char *path)
|
||||||
|
if (!is_fake_pathname(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
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: less
|
Name: less
|
||||||
Version: 633
|
Version: 633
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Less is a pager that displays text files.
|
Summary: Less is a pager that displays text files.
|
||||||
License: GPLv3+ or BSD
|
License: GPLv3+ or BSD
|
||||||
URL: http://www.greenwoodsoftware.com/less
|
URL: http://www.greenwoodsoftware.com/less
|
||||||
@ -13,6 +13,7 @@ Patch4: backport-CVE-2024-32487.patch
|
|||||||
Patch5: backport-Don-t-return-READ_AGAIN-from-iread-if-no-data-has-ye.patch
|
Patch5: backport-Don-t-return-READ_AGAIN-from-iread-if-no-data-has-ye.patch
|
||||||
Patch6: backport-Fix-for-previous-fix.patch
|
Patch6: backport-Fix-for-previous-fix.patch
|
||||||
Patch7: backport-Avoid-stealing-data-from-an-input-program-that-uses-.patch
|
Patch7: backport-Avoid-stealing-data-from-an-input-program-that-uses-.patch
|
||||||
|
Patch8: backport-Do-not-assume-PATH_MAX-is-defined.patch
|
||||||
|
|
||||||
BuildRequires: gcc make ncurses-devel autoconf automake libtool
|
BuildRequires: gcc make ncurses-devel autoconf automake libtool
|
||||||
|
|
||||||
@ -51,6 +52,9 @@ autoreconf -ivf
|
|||||||
%{_mandir}/man1/*
|
%{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 10 2024 baiguo <baiguo@kylinos.cn> - 633-4
|
||||||
|
- Do not assume PATH_MAX is defined
|
||||||
|
|
||||||
* Mon Apr 29 2024 huyubiao <huyubiao@huawei.com> - 633-3
|
* Mon Apr 29 2024 huyubiao <huyubiao@huawei.com> - 633-3
|
||||||
- fix problem when a program piping into less reads from the tty, like sudo asking for password
|
- fix problem when a program piping into less reads from the tty, like sudo asking for password
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user