Use strlcpy() instead of strcpy()

This commit is contained in:
Bruce Hill 2025-03-03 16:22:38 -05:00
parent a92f70571f
commit 20c11b29b3

View File

@ -63,7 +63,7 @@ public file_t *load_file(file_t **files, const char *filename)
// Check for <file>:<line> // Check for <file>:<line>
if (strrchr(filename, ':')) { if (strrchr(filename, ':')) {
char tmp[PATH_MAX] = {0}; char tmp[PATH_MAX] = {0};
strcpy(tmp, filename); strlcpy(tmp, filename, sizeof(tmp));
char *colon = strrchr(tmp, ':'); char *colon = strrchr(tmp, ':');
*colon = '\0'; *colon = '\0';
file_t *f = load_file(files, tmp); file_t *f = load_file(files, tmp);