Author: pschweitzer
Date: Mon Feb 7 23:16:29 2011
New Revision: 50615
URL:
http://svn.reactos.org/svn/reactos?rev=50615&view=rev
Log:
[USETUP]
Fix a really mean bug: wcslen() returns the size in characters whereas MaximumLength has
to be in bytes.
Now, this sets MaximumLength to its appropriate size and prevents some memory issues (and
buffers having odd size, which is weird for an unicode string...).
Modified:
trunk/reactos/base/setup/usetup/cabinet.c
Modified: trunk/reactos/base/setup/usetup/cabinet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/cabinet.…
==============================================================================
--- trunk/reactos/base/setup/usetup/cabinet.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/cabinet.c [iso-8859-1] Mon Feb 7 23:16:29 2011
@@ -890,7 +890,7 @@
RtlInitAnsiString(&AnsiString, Search->File->FileName);
wcscpy(DestName, DestPath);
- UnicodeString.MaximumLength = sizeof(DestName) - wcslen(DestName);
+ UnicodeString.MaximumLength = sizeof(DestName) - wcslen(DestName) * sizeof(WCHAR);
UnicodeString.Buffer = DestName + wcslen(DestName);
UnicodeString.Length = 0;
RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);