Fix name length handing in RtlQueryAtomInAtomTable.
Modified: trunk/reactos/lib/rtl/atom.c
_____
Modified: trunk/reactos/lib/rtl/atom.c
--- trunk/reactos/lib/rtl/atom.c 2005-08-03 14:26:56 UTC (rev
16998)
+++ trunk/reactos/lib/rtl/atom.c 2005-08-03 14:45:39 UTC (rev
16999)
@@ -602,19 +602,10 @@
if (*NameLength < Length + sizeof(WCHAR))
{
- /* prevent underflow! */
- if (*NameLength >= sizeof(WCHAR))
- {
- Length = *NameLength - sizeof(WCHAR);
- }
- else
- {
- Length = 0;
- Status = STATUS_BUFFER_TOO_SMALL;
- }
+ *NameLength = Length;
+ Status = STATUS_BUFFER_TOO_SMALL;
}
-
- if (Length)
+ else
{
RtlCopyMemory(AtomName,
NameString,
@@ -652,19 +643,10 @@
if (*NameLength < Length + sizeof(WCHAR))
{
- /* prevent underflow! */
- if (*NameLength >= sizeof(WCHAR))
- {
- Length = *NameLength - sizeof(WCHAR);
- }
- else
- {
- Length = 0;
- Status = STATUS_BUFFER_TOO_SMALL;
- }
+ *NameLength = Length;
+ Status = STATUS_BUFFER_TOO_SMALL;
}
-
- if (Length)
+ else
{
RtlCopyMemory(AtomName,
Entry->Name,