Storage: Updated virtual storage label to use strlcpy

This commit is contained in:
Nick Shaw
2024-04-06 11:21:23 -04:00
parent aee2120dce
commit d05080820d

View File

@@ -742,9 +742,9 @@ FS_Error storage_process_virtual_format(StorageData* storage) {
SDError error = f_mkfs(sd_data->path, FM_ANY, 0, work, _MAX_SS); SDError error = f_mkfs(sd_data->path, FM_ANY, 0, work, _MAX_SS);
storage_process_virtual_mount(storage); storage_process_virtual_mount(storage);
const char* path = storage_file_get_path(mnt_image, mnt_image_storage); const char* path = storage_file_get_path(mnt_image, mnt_image_storage);
char* label = basename(path); const char* name = basename(path);
int len = strlen(label); char label[strlen(name) - 3];
label[len - 4] = '\0'; // truncate the .img extension strlcpy(label, name, sizeof(label));
f_setlabel(label); f_setlabel(label);
storage_process_virtual_unmount(storage); storage_process_virtual_unmount(storage);
free(work); free(work);