[PATCH 01/10] dmloader: Handle NULL and empty path strings in SetSearchDirectory()

Michael Stefaniuc mstefani at winehq.org
Tue Jul 25 13:57:18 CDT 2017


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/dmloader/loader.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c
index aa5dfed..6d58d43 100644
--- a/dlls/dmloader/loader.c
+++ b/dlls/dmloader/loader.c
@@ -522,9 +522,14 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetSearchDirectory(IDirectMusicLoad
 
     TRACE("(%p, %s, %s, %d)\n", This, debugstr_dmguid(class), debugstr_w(path), clear);
 
-    attr = GetFileAttributesW(path);
-    if (attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY))
-        return DMUS_E_LOADER_BADPATH;
+    if (!path)
+        return E_POINTER;
+
+    if (path[0]) {
+        attr = GetFileAttributesW(path);
+        if (attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY))
+            return DMUS_E_LOADER_BADPATH;
+    }
 
     if (clear)
         FIXME("clear flag ignored\n");
-- 
2.9.4




More information about the wine-patches mailing list