Browse code

file: replace strncpy+strncat with a single snprintf call

Sigrid Solveig Haflínudóttir authored on 07/11/2021 19:00:56
Showing 1 changed files
... ...
@@ -72,9 +72,7 @@ file_read_dir(void *dest, Uint16 len)
72 72
 		Uint16 n;
73 73
 		if(de->d_name[0] == '.' && de->d_name[1] == '\0')
74 74
 			continue;
75
-		strncpy(pathname, current_filename, sizeof(pathname) - 1);
76
-		strncat(pathname, "/", sizeof(pathname) - 1);
77
-		strncat(pathname, de->d_name, sizeof(pathname) - 1);
75
+		snprintf(pathname, sizeof(pathname), "%s/%s", current_filename, de->d_name);
78 76
 		n = get_entry(p, len, pathname, de->d_name, 1);
79 77
 		if(!n) break;
80 78
 		p += n;