if (HashLink != NULL)
{
ULONG AtomNameLen = wcslen(AtomName);
+
+ if (AtomNameLen > MAX_ATOM_LEN)
+ {
+ Status = STATUS_INVALID_PARAMETER;
+ goto end;
+ }
Entry = RtlpAllocAtomTableEntry(sizeof(RTL_ATOM_TABLE_ENTRY) -
sizeof(Entry->Name) +
Status = STATUS_OBJECT_NAME_INVALID;
}
}
-
+end:
RtlpUnlockAtomTable(AtomTable);
return Status;
PULONG NameLength)
{
ULONG Length;
+ BOOL Unlock = FALSE;
+
union
{
/* A RTL_ATOM_TABLE_ENTRY has a "WCHAR Name[1]" entry at the end.
else
{
RtlpLockAtomTable(AtomTable);
+ Unlock = TRUE;
Entry = RtlpGetAtomEntry(AtomTable,
(ULONG)((USHORT)Atom - 0xC000));
Status = STATUS_INVALID_HANDLE;
}
- if (NULL != Entry && Entry != &NumberEntry.AtomTableEntry)
- {
- RtlpUnlockAtomTable(AtomTable);
- }
+ if (Unlock) RtlpUnlockAtomTable(AtomTable);
return Status;
}