=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: dwrite: Fix possible NULL pointer access in heap_strdup*.

Alexandre Julliard julliard at winehq.org
Mon Nov 19 13:38:39 CST 2012


Module: wine
Branch: master
Commit: 7e2cac2602e1b7f894ffa7a61b0f8600d4dbddbe
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7e2cac2602e1b7f894ffa7a61b0f8600d4dbddbe

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sat Nov 17 22:52:26 2012 +0100

dwrite: Fix possible NULL pointer access in heap_strdup*.

---

 dlls/dwrite/dwrite_private.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 54ae0dc..0c2698e 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -47,7 +47,8 @@ static inline LPWSTR heap_strdupW(const WCHAR *str)
 
         size = (strlenW(str)+1)*sizeof(WCHAR);
         ret = heap_alloc(size);
-        memcpy(ret, str, size);
+        if(ret)
+            memcpy(ret, str, size);
     }
 
     return ret;
@@ -60,8 +61,11 @@ static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len)
     if (len)
     {
         ret = heap_alloc((len+1)*sizeof(WCHAR));
-        memcpy(ret, str, len*sizeof(WCHAR));
-        ret[len] = 0;
+        if(ret)
+        {
+            memcpy(ret, str, len*sizeof(WCHAR));
+            ret[len] = 0;
+        }
     }
 
     return ret;




More information about the wine-cvs mailing list