advpack: Fix possible NULL pointer access in heap_strdupWtoA

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


we already do that (ieframe,vbscript,wininet,.. are good examples), but not consistent all over the place

---
 dlls/advpack/advpack_private.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/advpack/advpack_private.h b/dlls/advpack/advpack_private.h
index a1bcfe4..5d74897 100644
--- a/dlls/advpack/advpack_private.h
+++ b/dlls/advpack/advpack_private.h
@@ -44,7 +44,8 @@ static inline char *heap_strdupWtoA(const WCHAR *str)
     if(str) {
         size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
         ret = heap_alloc(size);
-        WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
+        if(ret)
+            WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
     }
 
     return ret;
-- 
1.8.0



-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list