[PATCH 4/5] shell/main_edit.c: Fix use of wrong constant

Frank Kuehndel frank.kuehndel at embedded-brains.de
Tue Oct 13 13:48:58 UTC 2020


From: Frank Kühndel <frank.kuehndel at embedded-brains.de>

realpath() requires a buffer of size PATH_MAX and not of size
FILENAME_MAX according to 'man realpath (3)'.
---
 cpukit/libmisc/shell/main_edit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
index e43ff68d2b..02214bd942 100644
--- a/cpukit/libmisc/shell/main_edit.c
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -32,6 +32,7 @@
 //
 
 #include <signal.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>
@@ -282,7 +283,7 @@ static void delete_editor(struct editor *ed) {
 }
 
 static struct editor *find_editor(struct env *env, char *filename) {
-  char fn[FILENAME_MAX];
+  char fn[PATH_MAX];
   struct editor *ed = env->current;
   struct editor *start = ed;
 
-- 
2.26.2



More information about the devel mailing list