diff --git a/reactos/lib/ntdll/rtl/unicode.c b/reactos/lib/ntdll/rtl/unicode.c index 0e119326088..816458558c2 100644 --- a/reactos/lib/ntdll/rtl/unicode.c +++ b/reactos/lib/ntdll/rtl/unicode.c @@ -1,4 +1,4 @@ -/* $Id: unicode.c,v 1.19 2002/02/09 23:29:50 ekohl Exp $ +/* $Id: unicode.c,v 1.20 2002/04/01 22:13:15 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -14,6 +14,8 @@ //#include #include #include +#define NDEBUG +#include /* FUNCTIONS *****************************************************************/ @@ -88,8 +90,11 @@ RtlAnsiStringToUnicodeString( } else { - if (Length >= DestinationString->MaximumLength) + if (Length + sizeof(WCHAR) > DestinationString->MaximumLength) + { + DPRINT("STATUS_BUFFER_TOO_SMALL\n"); return STATUS_BUFFER_TOO_SMALL; + } } DestinationString->Length = Length; @@ -988,8 +993,11 @@ RtlOemStringToUnicodeString ( } else { - if (Length > DestinationString->MaximumLength) + if (Length + sizeof(WCHAR) > DestinationString->MaximumLength) + { + DPRINT("STATUS_BUFFER_TOO_SMALL\n"); return STATUS_BUFFER_TOO_SMALL; + } } DestinationString->Length = Length; diff --git a/reactos/ntoskrnl/rtl/unicode.c b/reactos/ntoskrnl/rtl/unicode.c index 1d9ad2773a6..a4a528c9c41 100644 --- a/reactos/ntoskrnl/rtl/unicode.c +++ b/reactos/ntoskrnl/rtl/unicode.c @@ -1,4 +1,4 @@ -/* $Id: unicode.c,v 1.20 2002/02/09 23:29:12 ekohl Exp $ +/* $Id: unicode.c,v 1.21 2002/04/01 22:13:15 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -88,8 +88,11 @@ RtlAnsiStringToUnicodeString(IN OUT PUNICODE_STRING DestinationString, } else { - if (Length > DestinationString->MaximumLength) + if (Length + sizeof(WCHAR) > DestinationString->MaximumLength) + { + DPRINT("STATUS_BUFFER_TOO_SMALL\n"); return STATUS_BUFFER_TOO_SMALL; + } } DestinationString->Length = Length; @@ -868,8 +871,11 @@ RtlOemStringToUnicodeString(IN OUT PUNICODE_STRING DestinationString, } else { - if (Length >= DestinationString->MaximumLength) + if (Length + sizeof(WCHAR) > DestinationString->MaximumLength) + { + DPRINT("STATUS_BUFFER_TOO_SMALL\n"); return STATUS_BUFFER_TOO_SMALL; + } } DestinationString->Length = Length;