[PATCH] dbghelp: Check wImageName for NULL (Coverity)

Marcus Meissner marcus at jet.franken.de
Tue Dec 1 03:48:56 CST 2009


Hi,

wImageName can be NULL in here, so check and handle it.

Ciao, Marcus
---
 dlls/dbghelp/module.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index a6778e7..1920dca 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -534,6 +534,7 @@ DWORD64 WINAPI  SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
 
     if (Flags & SLMFLAG_VIRTUAL)
     {
+        if (!wImageName) return FALSE;
         module = module_new(pcs, wImageName, module_get_type_by_name(wImageName),
                             TRUE, (DWORD)BaseOfDll, SizeOfDll, 0, 0);
         if (!module) return FALSE;
@@ -594,7 +595,8 @@ DWORD64 WINAPI  SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
      */
     if (wModuleName)
         module_set_module(module, wModuleName);
-    lstrcpynW(module->module.ImageName, wImageName,
+    if (wImageName)
+        lstrcpynW(module->module.ImageName, wImageName,
               sizeof(module->module.ImageName) / sizeof(WCHAR));
 
     return module->module.BaseOfImage;
-- 
1.5.6



More information about the wine-patches mailing list