Author: mjmartin
Date: Thu Jun 3 09:08:07 2010
New Revision: 47529
URL:
http://svn.reactos.org/svn/reactos?rev=47529&view=rev
Log:
[rtl]
- len returned from mbstowcs is the required size of the destination string, so only
allocate the needed size.
- When doing the actual conversion pass in the size of the ansi string not the needed size
of destination.
- These changes were missed in 47527.
Modified:
trunk/reactos/lib/rtl/actctx.c
Modified: trunk/reactos/lib/rtl/actctx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=47529…
==============================================================================
--- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Thu Jun 3 09:08:07 2010
@@ -1578,6 +1578,7 @@
{
/* let's assume utf-8 for now */
int len;
+ WCHAR *new_buff;
_SEH2_TRY
{
@@ -1591,17 +1592,16 @@
_SEH2_END;
DPRINT("len = %x\n", len);
- WCHAR *new_buff;
if (len == -1)
{
DPRINT1( "utf-8 conversion failed\n" );
return STATUS_SXS_CANT_GEN_ACTCTX;
}
- if (!(new_buff = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len *
sizeof(WCHAR) )))
+ if (!(new_buff = RtlAllocateHeap( RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len)))
return STATUS_NO_MEMORY;
- mbstowcs( new_buff, buffer, len);
+ mbstowcs( new_buff, buffer, size);
xmlbuf.ptr = new_buff;
DPRINT("Buffer %S\n", new_buff);
xmlbuf.end = xmlbuf.ptr + len;