mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Fixed a wrong length check in RtlAnsiStringToUnicodeString()/RtlOemStringToUnicodeString().
svn path=/trunk/; revision=2814
This commit is contained in:
parent
0bdd211873
commit
9e6b238365
2 changed files with 20 additions and 6 deletions
|
@ -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 <internal/nls.h>
|
||||
#include <ctype.h>
|
||||
#include <ntos/minmax.h>
|
||||
#define NDEBUG
|
||||
#include <ntdll/ntdll.h>
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue