[PATCH] shell32: fixed potential NULL ptr deref (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Jan 31 04:32:51 CST 2009


Hi,

CID 824, psfParent might be NULL.

Ciao, Marcus
---
 dlls/shell32/shell32_main.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 78a2d57..8081408 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -440,10 +440,14 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
         }
         else
         {
-            STRRET str;
-            hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
-                                                SHGDN_INFOLDER, &str);
-            StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
+            if (psfParent) {
+                STRRET str;
+                hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
+                                                    SHGDN_INFOLDER, &str);
+                StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
+            } else {
+                FIXME("psfParent is NULL, unable to get szDisplayName\n");
+            }
         }
     }
 
-- 
1.5.6



More information about the wine-patches mailing list