diff options
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/file.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 53a1a35b31..da85846a34 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -65,7 +65,8 @@ static int open_internal(const char* pathname, int flags, bool use_cache) | |||
65 | DIR_UNCACHED* dir; | 65 | DIR_UNCACHED* dir; |
66 | struct dirent_uncached* entry; | 66 | struct dirent_uncached* entry; |
67 | int fd; | 67 | int fd; |
68 | char pathnamecopy[MAX_PATH]; | 68 | int pathnamesize = strlen(pathname) + 1; |
69 | char pathnamecopy[pathnamesize]; | ||
69 | char* name; | 70 | char* name; |
70 | struct filedesc* file = NULL; | 71 | struct filedesc* file = NULL; |
71 | int rc; | 72 | int rc; |
@@ -133,7 +134,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache) | |||
133 | } | 134 | } |
134 | #endif | 135 | #endif |
135 | 136 | ||
136 | strlcpy(pathnamecopy, pathname, sizeof(pathnamecopy)); | 137 | strlcpy(pathnamecopy, pathname, pathnamesize); |
137 | 138 | ||
138 | /* locate filename */ | 139 | /* locate filename */ |
139 | name=strrchr(pathnamecopy+1,'/'); | 140 | name=strrchr(pathnamecopy+1,'/'); |