# HG changeset patch # User reimar # Date 1159022185 0 # Node ID 92b4bcd07f0e0a4e677603fb841d73a772a56722 # Parent f53f1a780a54ee24dc433d49cc09944bee1bb45c Avoid buffer overflow: memory has do be allocated accordingly when overwriting a string! diff -r f53f1a780a54 -r 92b4bcd07f0e Gui/win32/preferences.c --- a/Gui/win32/preferences.c Sat Sep 23 14:34:32 2006 +0000 +++ b/Gui/win32/preferences.c Sat Sep 23 14:36:25 2006 +0000 @@ -562,14 +562,21 @@ 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 */