From: Michael Martin Date: Thu, 3 Jun 2010 07:08:07 +0000 (+0000) Subject: [rtl] X-Git-Tag: backups/header-work@57446~11^2~105 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=be344838ef925f349a84e63613d4cc4f6c686749 [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. svn path=/trunk/; revision=47529 --- diff --git a/reactos/lib/rtl/actctx.c b/reactos/lib/rtl/actctx.c index 7960f587490..9ad67e053fd 100644 --- a/reactos/lib/rtl/actctx.c +++ b/reactos/lib/rtl/actctx.c @@ -1578,6 +1578,7 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident { /* let's assume utf-8 for now */ int len; + WCHAR *new_buff; _SEH2_TRY { @@ -1591,17 +1592,16 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident _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;