uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 677b02f0a3ee3c9e9c1454dfd9b0ab41bf2a2f7b
parent 90225ad773631a5807713dc06c450ecbc5d32bab
Author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
Date:   Sun,  7 Nov 2021 20:00:56 +0100

file: replace strncpy+strncat with a single snprintf call

Diffstat:
Msrc/devices/file.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/devices/file.c b/src/devices/file.c @@ -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;