[MPlayer-cvslog] r19954 - trunk/Gui/win32/preferences.c

reimar subversion at mplayerhq.hu
Sat Sep 23 16:36:25 CEST 2006


Author: reimar
Date: Sat Sep 23 16:36:25 2006
New Revision: 19954

Modified:
   trunk/Gui/win32/preferences.c

Log:
Avoid buffer overflow: memory has do be allocated accordingly when overwriting a string!


Modified: trunk/Gui/win32/preferences.c
==============================================================================
--- trunk/Gui/win32/preferences.c	(original)
+++ trunk/Gui/win32/preferences.c	Sat Sep 23 16:36:25 2006
@@ -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 */



More information about the MPlayer-cvslog mailing list