summary refs log tree commit diff
path: root/gnu/packages/patches/less-hurd-path-max.patch
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2020-03-07 14:55:35 +0100
committerJan Nieuwenhuizen <janneke@gnu.org>2020-03-26 12:59:33 +0100
commit7baa8c78983424497f5db522243e9e396c99eb12 (patch)
treecbc1c6bd49d6fd57b5c7d9780a1a3f8f6b4ed2f9 /gnu/packages/patches/less-hurd-path-max.patch
parentd0ed201e0a9736c64cb3c59d8c987c79fd6046d6 (diff)
downloadguix-7baa8c78983424497f5db522243e9e396c99eb12.tar.gz
gnu: less: Build fix for the Hurd.
* gnu/packages/patches/less-hurd-path-max.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/less.scm (less): Use it.
Diffstat (limited to 'gnu/packages/patches/less-hurd-path-max.patch')
-rw-r--r--gnu/packages/patches/less-hurd-path-max.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/gnu/packages/patches/less-hurd-path-max.patch b/gnu/packages/patches/less-hurd-path-max.patch
new file mode 100644
index 0000000000..4d23a08788
--- /dev/null
+++ b/gnu/packages/patches/less-hurd-path-max.patch
@@ -0,0 +1,36 @@
+Avoid usage of PATH_MAX.
+
+Submitted to bug-less@gnu.org.
+
+From ef652341ed8b2c14ac40312ccd4ed329cb69fd0c Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Sat, 7 Mar 2020 14:57:19 +0100
+Subject: [PATCH] Avoid usage of PATH_MAX.
+
+* filename.c (lrealpath): Have realpath allocate the buffer.  Fixes
+compilation on the Hurd and avoids possible buffer overflow on other
+systems.
+---
+ filename.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/filename.c b/filename.c
+index e420837..faa71b0 100644
+--- a/filename.c
++++ b/filename.c
+@@ -795,9 +795,9 @@ lrealpath(path)
+ 	char *path;
+ {
+ #if HAVE_REALPATH
+-	char rpath[PATH_MAX];
+-	if (realpath(path, rpath) != NULL)
+-		return (save(rpath));
++	char *rpath = NULL;
++	if ((rpath = realpath(path, rpath)) != NULL)
++		return (rpath);
+ #endif
+ 	return (save(path));
+ }
+-- 
+2.24.0
+