mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Fix name length handing in RtlQueryAtomInAtomTable.
svn path=/trunk/; revision=16999
This commit is contained in:
parent
1eaff64466
commit
e51757630c
1 changed files with 6 additions and 24 deletions
|
@ -602,19 +602,10 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
|
|
||||||
if (*NameLength < Length + sizeof(WCHAR))
|
if (*NameLength < Length + sizeof(WCHAR))
|
||||||
{
|
{
|
||||||
/* prevent underflow! */
|
*NameLength = Length;
|
||||||
if (*NameLength >= sizeof(WCHAR))
|
|
||||||
{
|
|
||||||
Length = *NameLength - sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Length = 0;
|
|
||||||
Status = STATUS_BUFFER_TOO_SMALL;
|
Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if (Length)
|
|
||||||
{
|
{
|
||||||
RtlCopyMemory(AtomName,
|
RtlCopyMemory(AtomName,
|
||||||
NameString,
|
NameString,
|
||||||
|
@ -652,19 +643,10 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable,
|
||||||
|
|
||||||
if (*NameLength < Length + sizeof(WCHAR))
|
if (*NameLength < Length + sizeof(WCHAR))
|
||||||
{
|
{
|
||||||
/* prevent underflow! */
|
*NameLength = Length;
|
||||||
if (*NameLength >= sizeof(WCHAR))
|
|
||||||
{
|
|
||||||
Length = *NameLength - sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Length = 0;
|
|
||||||
Status = STATUS_BUFFER_TOO_SMALL;
|
Status = STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if (Length)
|
|
||||||
{
|
{
|
||||||
RtlCopyMemory(AtomName,
|
RtlCopyMemory(AtomName,
|
||||||
Entry->Name,
|
Entry->Name,
|
||||||
|
|
Loading…
Reference in a new issue