file: replace strncpy+strncat with a single snprintf call

This commit is contained in:
Sigrid Solveig Haflínudóttir 2021-11-07 20:00:56 +01:00
parent 90225ad773
commit 677b02f0a3
No known key found for this signature in database
GPG Key ID: FC8DDA5A6A7456C4
1 changed files with 1 additions and 3 deletions

View File

@ -72,9 +72,7 @@ file_read_dir(void *dest, Uint16 len)
Uint16 n;
if(de->d_name[0] == '.' && de->d_name[1] == '\0')
continue;
strncpy(pathname, current_filename, sizeof(pathname) - 1);
strncat(pathname, "/", sizeof(pathname) - 1);
strncat(pathname, de->d_name, sizeof(pathname) - 1);
snprintf(pathname, sizeof(pathname), "%s/%s", current_filename, de->d_name);
n = get_entry(p, len, pathname, de->d_name, 1);
if(!n) break;
p += n;