cmd: Fix possible NULL pointer access in heap_strdupW

André Hentschel nerv at dawncrow.de
Sat Nov 17 15:52:41 CST 2012


we already do that (ieframe,vbscript,wininet,.. are good examples), but not consistent all over the place
---
 programs/cmd/wcmd.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 3cc4c0b..303d260 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -142,7 +142,8 @@ static inline WCHAR *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;
-- 
1.8.0


-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list