Author: pschweitzer
Date: Sun Feb 19 13:22:02 2017
New Revision: 73845
URL:
http://svn.reactos.org/svn/reactos?rev=73845&view=rev
Log:
[SHELL32]
For the input string, WideCharToMultiByte takes a char count and not a buffer size.
CID 1401096, 1401088
Modified:
trunk/reactos/dll/win32/shell32/CShellLink.cpp
Modified: trunk/reactos/dll/win32/shell32/CShellLink.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CShellLi…
==============================================================================
--- trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/CShellLink.cpp [iso-8859-1] Sun Feb 19 13:22:02 2017
@@ -1074,13 +1074,17 @@
/* Copy the file data if a file path was returned */
if (*pszFile)
{
+ DWORD len;
+
/* Copy the fixed part */
CopyMemory(pfd, &wfd, FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
/* Convert the file names to ANSI */
- WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, sizeof(wfd.cFileName),
+ len = lstrlenW(wfd.cFileName);
+ WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, len + 1,
pfd->cFileName, sizeof(pfd->cFileName), NULL,
NULL);
- WideCharToMultiByte(CP_ACP, 0, wfd.cAlternateFileName,
sizeof(wfd.cAlternateFileName),
+ len = lstrlenW(wfd.cAlternateFileName);
+ WideCharToMultiByte(CP_ACP, 0, wfd.cAlternateFileName, len + 1,
pfd->cAlternateFileName,
sizeof(pfd->cAlternateFileName), NULL, NULL);
}
}