Replace a VLA with char[MAXPATHLEN].

This commit is contained in:
Themaister 2011-09-20 12:50:13 +03:00
parent efe3f943d5
commit 5e14b302bc
1 changed files with 2 additions and 2 deletions

4
file.c
View File

@ -947,8 +947,8 @@ bool path_file_exists(const char *path)
void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size) void fill_pathname(char *out_path, const char *in_path, const char *replace, size_t size)
{ {
char tmp_path[strlen(in_path) + 1]; char tmp_path[MAXPATHLEN];
strlcpy(tmp_path, in_path, sizeof(tmp_path)); assert(strlcpy(tmp_path, in_path, sizeof(tmp_path)) < sizeof(tmp_path));
char *tok = strrchr(tmp_path, '.'); char *tok = strrchr(tmp_path, '.');
if (tok != NULL) if (tok != NULL)
*tok = '\0'; *tok = '\0';