Fixed a potential overrun in the CD-ROM image backend code.

This commit is contained in:
OBattler
2020-01-15 02:22:30 +01:00
parent ae9f8fb639
commit bb3c5a6f52

View File

@@ -149,10 +149,10 @@ bin_init(const wchar_t *filename, int *error)
}
memset(tf->fn, 0x00, sizeof(tf->fn));
if (wcslen(tf->fn) > 260)
wcsncpy(tf->fn, filename, 260);
else
if (wcslen(filename) <= 260)
wcscpy(tf->fn, filename);
else
wcsncpy(tf->fn, filename, 260);
tf->file = plat_fopen64(tf->fn, L"rb");
cdrom_image_backend_log("CDROM: binary_open(%ls) = %08lx\n", tf->fn, tf->file);