Fixed another potential overrun in win/win_settings.c.

This commit is contained in:
OBattler
2020-01-15 01:07:06 +01:00
parent 21974c5fc5
commit 171cc75b1e

View File

@@ -3731,7 +3731,7 @@ static void
win_settings_floppy_drives_update_item(HWND hwndList, int i)
{
LVITEM lvI;
char s[256];
char s[256], *t;
WCHAR szText[256];
lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
@@ -3741,7 +3741,11 @@ win_settings_floppy_drives_update_item(HWND hwndList, int i)
lvI.iItem = i;
if (temp_fdd_types[i] > 0) {
strcpy(s, fdd_getname(temp_fdd_types[i]));
t = fdd_getname(temp_fdd_types[i]);
if (strlen(t) <= 256)
strcpy(s, t);
else
strncpy(s, t, 256);
mbstowcs(szText, s, strlen(s) + 1);
lvI.pszText = szText;
} else