From d0b5c79b81ecdcf2df4833dece74449b90766fea Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Mon, 24 Oct 2022 11:39:33 +0200 Subject: Use box_strdup instead of realpath for the string allocation to be safe --- src/tools/fileutils.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c index c9765740..af6634a0 100755 --- a/src/tools/fileutils.c +++ b/src/tools/fileutils.c @@ -57,8 +57,11 @@ char* ResolveFile(const char* filename, path_collection_t* paths) } else strcpy(p, paths->paths[i]); strcat(p, filename); - if(FileExist(p, IS_FILE)) - return realpath(p, NULL); + if(FileExist(p, IS_FILE)) { + char p2[MAX_PATH]; + realpath(p, p2); + return box_strdup(p2); + } } return box_strdup(filename); //NULL; -- cgit 1.4.1