From 4137480167846104405aac68d5453ac8d30c93cb Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 23 Sep 2006 14:36:25 +0000 Subject: Avoid buffer overflow: memory has do be allocated accordingly when overwriting a string! git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19954 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/win32/preferences.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Gui/win32') diff --git a/Gui/win32/preferences.c b/Gui/win32/preferences.c index b338e9538d..0063a6ac13 100644 --- a/Gui/win32/preferences.c +++ b/Gui/win32/preferences.c @@ -562,14 +562,21 @@ static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM return 0; case ID_APPLY: { + int strl; if(guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *)guiSetStop); /* Set the video driver */ - SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)SendMessage(vo_driver, CB_GETCURSEL, 0, 0), + gfree(video_driver_list[0]); + strl = SendMessage(vo_driver, CB_GETCURSEL, 0, 0); + video_driver_list[0] = malloc(strl); + SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)strl, (LPARAM)video_driver_list[0]); /* Set the audio driver */ - SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)SendMessage(ao_driver, CB_GETCURSEL, 0, 0), + gfree(audio_driver_list[0]); + strl = SendMessage(ao_driver, CB_GETCURSEL, 0, 0); + audio_driver_list[0] = malloc(strl); + SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)strl, (LPARAM)audio_driver_list[0]); /* Set the priority level */ -- cgit v1.2.3