winex11.drv: Avoid a potential dereferencing outside of dd_modes array

Dmitry Timoshkov dmitry at codeweavers.com
Fri Jul 20 03:25:53 CDT 2007


Hello,

Changelog:
    winex11.drv: Avoid a potential dereferencing outside of dd_modes array.

---
 dlls/winex11.drv/settings.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
index cc6dd2c..aaa7ff6 100644
--- a/dlls/winex11.drv/settings.c
+++ b/dlls/winex11.drv/settings.c
@@ -80,13 +80,16 @@ LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name,
 /* Add one mode to the master list */
 void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigned int bpp, unsigned int freq)
 {
-    LPDDHALMODEINFO info = &(dd_modes[dd_mode_count]);
+    LPDDHALMODEINFO info;
     DWORD dwBpp = screen_depth;
+
     if (dd_mode_count >= dd_max_modes)
     {
         ERR("Maximum modes (%d) exceeded\n", dd_max_modes);
         return;
     }
+
+    info = &dd_modes[dd_mode_count];
     if (dwBpp == 24) dwBpp = 32;
     if (bpp == 0) bpp = dwBpp;
     info->dwWidth        = width;
-- 
1.5.2.3






More information about the wine-patches mailing list