ole32: Avoid a possible null dereference

Bruno Jesus 00cpxxx at gmail.com
Thu Nov 13 18:13:40 CST 2014


The variable passed to the function is tested against NULL after this
function is called so it may be possible to crash.
-------------- next part --------------
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index a7308c2..afb94d1 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -214,8 +214,11 @@ static inline char *dump_fmtetc(FORMATETC *fmt)
 {
     static char buf[100];
 
-    snprintf(buf, sizeof(buf), "cf %04x ptd %p aspect %x lindex %d tymed %x",
-             fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed);
+    if (fmt)
+        snprintf(buf, sizeof(buf), "cf %04x ptd %p aspect %x lindex %d tymed %x",
+                 fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed);
+    else
+        strcpy(buf, "(null)");
     return buf;
 }
 


More information about the wine-patches mailing list