bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Reserve byte for '\0' in readlink result


From: Tobias Stoeckmann
Subject: [PATCH] Reserve byte for '\0' in readlink result
Date: Sun, 12 Jul 2015 11:52:32 +0200

Very long symbolic links could completely fill the buffer. Adding a
terminating '\0' later on would overflow it by one byte.
---
 remake.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/remake.c b/remake.c
index 0888cff..854c42b 100644
--- a/remake.c
+++ b/remake.c
@@ -1520,7 +1520,7 @@ name_mtime (const char *name)
             mtime = ltime;
 
           /* Set up to check the file pointed to by this link.  */
-          EINTRLOOP (llen, readlink (lpath, lbuf, GET_PATH_MAX));
+          EINTRLOOP (llen, readlink (lpath, lbuf, GET_PATH_MAX - 1));
           if (llen < 0)
             {
               /* Eh?  Just take what we have.  */
-- 
2.4.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]