From 757ff359b58c15d66807d3183606ee73d97d728d Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sun, 15 Feb 2004 07:04:45 +0000 Subject: [PATCH] Fixed a bug in AppendUnicodeStringToString which could cause a null to be placed one position after the end of a completely full string. svn path=/trunk/; revision=8191 --- reactos/lib/ntdll/rtl/unicode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/lib/ntdll/rtl/unicode.c b/reactos/lib/ntdll/rtl/unicode.c index 42ae9d20682..f182f7f55d8 100644 --- a/reactos/lib/ntdll/rtl/unicode.c +++ b/reactos/lib/ntdll/rtl/unicode.c @@ -1,4 +1,4 @@ -/* $Id: unicode.c,v 1.36 2004/02/03 14:37:35 ekohl Exp $ +/* $Id: unicode.c,v 1.37 2004/02/15 07:04:45 arty Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -203,7 +203,8 @@ RtlAppendUnicodeStringToString( memcpy((PVOID)Destination->Buffer + Destination->Length, Source->Buffer, Source->Length); Destination->Length += Source->Length; - Destination->Buffer[Destination->Length / sizeof(WCHAR)] = 0; + if( Destination->MaximumLength > Destination->Length ) + Destination->Buffer[Destination->Length / sizeof(WCHAR)] = 0; return STATUS_SUCCESS; }