Fix strncpy() call to use nuklear API (#595)

This commit is contained in:
Victor Chernyakin 2024-04-04 10:13:08 -07:00 committed by GitHub
parent d1fa8f7614
commit c8e91e571c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -345,7 +345,8 @@ media_init(struct media *media)
static void
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;
dir_free_list(browser->files, browser->file_count);
dir_free_list(browser->directories, browser->dir_count);