commit 5be16542a3ad371cccb8d4da0ffbe3994e67c131
parent 72f25263b10102c2b72f32c97aec98e057675bbd
Author: Cem Keylan <cem@ckyln.com>
Date: Thu, 23 Jul 2020 11:51:41 +0300
kiss-readlink: define DIR_MAX for the dname array
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bin/kiss-readlink.c b/bin/kiss-readlink.c
@@ -9,6 +9,8 @@
#include <string.h>
#include <limits.h>
+#define DIR_MAX PATH_MAX - NAME_MAX - 1
+
char *realpath(const char *path, char *resolved_path);
@@ -22,7 +24,7 @@ main(int argc, char *argv[])
* use directories above the file. We are using dname and bname so that
* they don't clash with the functions with the same name.
*/
- char dname[PATH_MAX]; /* directory name */
+ char dname[DIR_MAX]; /* directory name */
char bname[NAME_MAX]; /* base name */
sprintf(bname, "%s", (basename(argv[1])));