Added pointer validation and additional sanity check to IsValidSid().

This commit is contained in:
Ian Schmidt 1999-07-18 18:29:34 +00:00 committed by Alexandre Julliard
parent b49b411784
commit e6bffc0965
1 changed files with 9 additions and 0 deletions

View File

@ -202,6 +202,15 @@ CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
BOOL WINAPI BOOL WINAPI
IsValidSid( PSID pSid ) IsValidSid( PSID pSid )
{ {
if (IsBadReadPtr(pSid, 4))
{
WARN_(security)("(%p): invalid pointer!", pSid);
return FALSE;
}
if (pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
return FALSE;
if (!pSid || pSid->Revision != SID_REVISION) if (!pSid || pSid->Revision != SID_REVISION)
return FALSE; return FALSE;