From e6bffc0965119a4ed1e23b84ff3f517da9d0716a Mon Sep 17 00:00:00 2001 From: Ian Schmidt Date: Sun, 18 Jul 1999 18:29:34 +0000 Subject: [PATCH] Added pointer validation and additional sanity check to IsValidSid(). --- dlls/advapi32/security.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index c8aeb3679b7..3d43f7f2309 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -202,6 +202,15 @@ CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ) BOOL WINAPI 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) return FALSE; -- 2.11.4.GIT