From 171cc75b1ec175125a8aaea61935a7b25fa77dd2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 15 Jan 2020 01:07:06 +0100 Subject: [PATCH] Fixed another potential overrun in win/win_settings.c. --- src/win/win_settings.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 8b9dff3c8..84d257b34 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -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