Author: akhaldi
Date: Mon Aug 26 21:36:16 2013
New Revision: 59839
URL:
http://svn.reactos.org/svn/reactos?rev=59839&view=rev
Log:
[KERNEL32]
* Check more parameters in MultiByteToWideChar() and WideCharToMultibyte(). By Marcus
Boillat.
* Fixes 4 kernel32:codepage tests.
CORE-7411 #resolve #comment Committed in r59839 with formatting fixes. Thanks.
Modified:
trunk/reactos/dll/win32/kernel32/winnls/string/nls.c
Modified: trunk/reactos/dll/win32/kernel32/winnls/string/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/winnls/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/winnls/string/nls.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/winnls/string/nls.c [iso-8859-1] Mon Aug 26 21:36:16
2013
@@ -1465,6 +1465,7 @@
{
/* Check the parameters. */
if (MultiByteString == NULL ||
+ MultiByteCount == 0 ||
(WideCharString == NULL && WideCharCount > 0) ||
(PVOID)MultiByteString == (PVOID)WideCharString)
{
@@ -1899,6 +1900,7 @@
{
/* Check the parameters. */
if (WideCharString == NULL ||
+ WideCharCount == 0 ||
(MultiByteString == NULL && MultiByteCount > 0) ||
(PVOID)WideCharString == (PVOID)MultiByteString ||
MultiByteCount < 0)
@@ -1916,6 +1918,11 @@
switch (CodePage)
{
case CP_UTF8:
+ if (DefaultChar != NULL || UsedDefaultChar != NULL)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return 0;
+ }
return IntWideCharToMultiByteUTF8(CodePage,
Flags,
WideCharString,