Fix strncpy()
call to use nuklear API (#595)
This commit is contained in:
parent
d1fa8f7614
commit
c8e91e571c
@ -345,7 +345,8 @@ media_init(struct media *media)
|
|||||||
static void
|
static void
|
||||||
file_browser_reload_directory_content(struct file_browser *browser, const char *path)
|
file_browser_reload_directory_content(struct file_browser *browser, const char *path)
|
||||||
{
|
{
|
||||||
strncpy(browser->directory, path, MAX_PATH_LEN);
|
const size_t path_len = nk_strlen(path) + 1;
|
||||||
|
NK_MEMCPY(browser->directory, path, MIN(path_len, MAX_PATH_LEN));
|
||||||
browser->directory[MAX_PATH_LEN - 1] = 0;
|
browser->directory[MAX_PATH_LEN - 1] = 0;
|
||||||
dir_free_list(browser->files, browser->file_count);
|
dir_free_list(browser->files, browser->file_count);
|
||||||
dir_free_list(browser->directories, browser->dir_count);
|
dir_free_list(browser->directories, browser->dir_count);
|
||||||
|
Loading…
Reference in New Issue
Block a user