Fixed a potential overrun in the Intel flash code.

This commit is contained in:
OBattler
2020-01-15 00:43:51 +01:00
parent d5100ec287
commit 1d2721b9bd

View File

@@ -330,7 +330,10 @@ intel_flash_init(const device_t *info)
flash_name = (wchar_t *)malloc(l*sizeof(wchar_t));
swprintf(flash_name, l, L"%ls.bin", machine_name);
wcscpy(flash_path, flash_name);
if (wcslen(flash_name) <= 1024)
wcscpy(flash_path, flash_name);
else
wcsncpy(flash_path, flash_name, 1024);
dev->flags = info->local & 0xff;