From 3f144fc7a9ed06b753cc20211f6905d6ddb959bb Mon Sep 17 00:00:00 2001 From: Fisherman166 Date: Sat, 17 Nov 2018 21:33:53 -0800 Subject: [PATCH] Fix bug in RtlAppendUnicodeStringToString where the terminating null character was being placed in the wrong byte. --- src/CxbxKrnl/EmuKrnlRtl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/CxbxKrnl/EmuKrnlRtl.cpp b/src/CxbxKrnl/EmuKrnlRtl.cpp index 2bca56f25..d2d0e1ae9 100644 --- a/src/CxbxKrnl/EmuKrnlRtl.cpp +++ b/src/CxbxKrnl/EmuKrnlRtl.cpp @@ -169,9 +169,8 @@ XBSYSAPI EXPORTNUM(262) xboxkrnl::NTSTATUS NTAPI xboxkrnl::RtlAppendUnicodeStrin result = STATUS_BUFFER_TOO_SMALL; } else { - CHAR *dstBuf = (CHAR*)(Destination->Buffer + (Destination->Length / sizeof(WCHAR))); - CHAR *srcBuf = (CHAR*)(Source->Buffer); - memmove(dstBuf, srcBuf, srcLen); + WCHAR *dstBuf = (WCHAR*)(Destination->Buffer + (Destination->Length / sizeof(WCHAR))); + memmove(dstBuf, Source->Buffer, srcLen); Destination->Length += srcLen; if (Destination->Length < Destination->MaximumLength) { dstBuf[srcLen / sizeof(WCHAR)] = UNICODE_NULL;