Fixed a potential overrun in the CD-ROM image backend code.
This commit is contained in:
@@ -149,10 +149,10 @@ bin_init(const wchar_t *filename, int *error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
memset(tf->fn, 0x00, sizeof(tf->fn));
|
memset(tf->fn, 0x00, sizeof(tf->fn));
|
||||||
if (wcslen(tf->fn) > 260)
|
if (wcslen(filename) <= 260)
|
||||||
wcsncpy(tf->fn, filename, 260);
|
|
||||||
else
|
|
||||||
wcscpy(tf->fn, filename);
|
wcscpy(tf->fn, filename);
|
||||||
|
else
|
||||||
|
wcsncpy(tf->fn, filename, 260);
|
||||||
tf->file = plat_fopen64(tf->fn, L"rb");
|
tf->file = plat_fopen64(tf->fn, L"rb");
|
||||||
cdrom_image_backend_log("CDROM: binary_open(%ls) = %08lx\n", tf->fn, tf->file);
|
cdrom_image_backend_log("CDROM: binary_open(%ls) = %08lx\n", tf->fn, tf->file);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user