diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-10-24 11:39:33 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-10-24 11:39:33 +0200 |
| commit | d0b5c79b81ecdcf2df4833dece74449b90766fea (patch) | |
| tree | 20aa1d787203fe0d8ab02380cec0102e4f247095 /src | |
| parent | 95622ca964ab37dff95e48d9d49c943df06b30d5 (diff) | |
| download | box64-d0b5c79b81ecdcf2df4833dece74449b90766fea.tar.gz box64-d0b5c79b81ecdcf2df4833dece74449b90766fea.zip | |
Use box_strdup instead of realpath for the string allocation to be safe
Diffstat (limited to 'src')
| -rwxr-xr-x | src/tools/fileutils.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; |