Replace a VLA with char[MAXPATHLEN].
This commit is contained in:
parent
efe3f943d5
commit
5e14b302bc
4
file.c
4
file.c
|
@ -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';
|
||||||
|
|
Loading…
Reference in New Issue