projects/guix·blob python-team · refs

36 lines · 867 B

1Avoid usage of PATH_MAX.
2
3Submitted to [email protected].
4
5From ef652341ed8b2c14ac40312ccd4ed329cb69fd0c Mon Sep 17 00:00:00 2001
6From: Jan Nieuwenhuizen <[email protected]>
7Date: Sat, 7 Mar 2020 14:57:19 +0100
8Subject: [PATCH] Avoid usage of PATH_MAX.
9
10* filename.c (lrealpath): Have realpath allocate the buffer. Fixes
11compilation on the Hurd and avoids possible buffer overflow on other
12systems.
13---
14 filename.c | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/filename.c b/filename.c
18index e420837..faa71b0 100644
19--- a/filename.c
20+++ b/filename.c
21@@ -795,9 +795,9 @@ lrealpath(path)
22 char *path;
23 {
24 #if HAVE_REALPATH
25- char rpath[PATH_MAX];
26- if (realpath(path, rpath) != NULL)
27- return (save(rpath));
28+ char *rpath = NULL;
29+ if ((rpath = realpath(path, rpath)) != NULL)
30+ return (rpath);
31 #endif
32 return (save(path));
33 }
34--
352.24.0
36