Author: janderwald
Date: Tue Jul 22 06:20:01 2008
New Revision: 34678
URL:
http://svn.reactos.org/svn/reactos?rev=34678&view=rev
Log:
- fix multiple bugs in mydocuments shellfolder:
- zero initialize buffer
- check return value of SHGetSpecialFolderPathW
- zeroize buffer in ISF_MyDocuments_fnGetDisplayNameOf
Modified:
trunk/reactos/dll/win32/shell32/shlfldr_mydocuments.c
Modified: trunk/reactos/dll/win32/shell32/shlfldr_mydocuments.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfldr_…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shlfldr_mydocuments.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shlfldr_mydocuments.c [iso-8859-1] Tue Jul 22 06:20:01
2008
@@ -235,17 +235,17 @@
}
/**************************************************************************
- * CreateDesktopEnumList()
- */
-static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
+ * CreateMyDocumentsEnumList()
+ */
+static BOOL CreateMyDocumentsEnumList(IEnumIDList *list, DWORD dwFlags)
{
BOOL ret = TRUE;
- WCHAR szPath[MAX_PATH];
+ WCHAR szPath[MAX_PATH] = {0};
TRACE("(%p)->(flags=0x%08x)\n", list, dwFlags);
/* enumerate the elements in %windir%\desktop */
- SHGetSpecialFolderPathW(0, szPath, CSIDL_MYDOCUMENTS, FALSE);
+ ret = SHGetSpecialFolderPathW(0, szPath, CSIDL_PERSONAL, FALSE);
ret = ret && CreateFolderEnumList(list, szPath, dwFlags);
return ret;
@@ -264,7 +264,7 @@
*ppEnumIDList = IEnumIDList_Constructor();
if (*ppEnumIDList)
- CreateDesktopEnumList(*ppEnumIDList, dwFlags);
+ CreateMyDocumentsEnumList(*ppEnumIDList, dwFlags);
TRACE ("-- (%p)->(new ID List: %p)\n", This, *ppEnumIDList);
@@ -499,6 +499,8 @@
pszPath = CoTaskMemAlloc((MAX_PATH +1) * sizeof(WCHAR));
if (!pszPath)
return E_OUTOFMEMORY;
+
+ ZeroMemory(pszPath, (MAX_PATH +1) * sizeof(WCHAR));
if (_ILIsMyDocuments (pidl))
{