Nikolay Sivov : shell32: Don't access uninitialized buffer (Coverity).

Alexandre Julliard julliard at winehq.org
Tue Feb 28 03:45:55 CST 2017


Module: wine
Branch: oldstable
Commit: fc49f58d0809bf89436f652a96787daf700c5ef3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=fc49f58d0809bf89436f652a96787daf700c5ef3

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Dec 14 22:16:11 2016 +0300

shell32: Don't access uninitialized buffer (Coverity).

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 3c6cbc2f910ae1ee905e385ea06bb537cc3d901d)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/shell32/shellpath.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 1c3ab59..d06ba2f 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -4735,6 +4735,7 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t
             hr = E_INVALIDARG;
             break;
         case CSIDL_Type_NonExistent:
+            *tempW = 0;
             hr = S_FALSE;
             break;
         case CSIDL_Type_WindowsPath:
@@ -4785,15 +4786,19 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t
             break;
     }
 
+    if (FAILED(hr))
+        goto failed;
+
     /* Expand environment strings if necessary */
     if (*tempW == '%')
+    {
         hr = _SHExpandEnvironmentStrings(tempW, pathW);
+        if (FAILED(hr))
+            goto failed;
+    }
     else
         strcpyW(pathW, tempW);
 
-    if (FAILED(hr))
-        goto failed;
-
     /* if we don't care about existing directories we are ready */
     if (flags & KF_FLAG_DONT_VERIFY) goto done;
 




More information about the wine-cvs mailing list