[PATCH 2/2] Fix a null pointer crash

Nikolay Sivov nsivov at codeweavers.com
Thu Dec 30 10:46:42 CST 2010


---
 programs/oleview/typelib.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c
index 7be31c9..336159f 100644
--- a/programs/oleview/typelib.c
+++ b/programs/oleview/typelib.c
@@ -195,14 +195,16 @@ static void AddToStrW(WCHAR *wszDest, const WCHAR *wszSource)
     lstrcpyW(&wszDest[lstrlenW(wszDest)], wszSource);
 }
 
-static void AddToTLDataStrW(TYPELIB_DATA *pTLData, const WCHAR *wszSource)
+static void AddToTLDataStrW(TYPELIB_DATA *pTLData, const WCHAR *Source)
 {
-    int SourceLen = lstrlenW(wszSource);
+    int SourceLen = lstrlenW(Source);
+
+    if (!Source) return;
 
     pTLData->idl = HeapReAlloc(GetProcessHeap(), 0, pTLData->idl,
             sizeof(WCHAR)*(pTLData->idlLen+SourceLen+1));
 
-    memcpy(&pTLData->idl[pTLData->idlLen], wszSource, sizeof(WCHAR)*(SourceLen+1));
+    memcpy(&pTLData->idl[pTLData->idlLen], Source, sizeof(WCHAR)*(SourceLen+1));
     pTLData->idlLen += SourceLen;
 }
 
-- 
1.5.6.5


--------------000506090200000209070205--



More information about the wine-patches mailing list