advapi32: QueryObjectSecurity should return a self-relative security descriptor and not overflow the buffer.
This commit is contained in:
parent
fef243cd8f
commit
c5c0a26f60
|
@ -2538,17 +2538,26 @@ BOOL WINAPI QueryServiceObjectSecurity(SC_HANDLE hService,
|
||||||
PSECURITY_DESCRIPTOR lpSecurityDescriptor,
|
PSECURITY_DESCRIPTOR lpSecurityDescriptor,
|
||||||
DWORD cbBufSize, LPDWORD pcbBytesNeeded)
|
DWORD cbBufSize, LPDWORD pcbBytesNeeded)
|
||||||
{
|
{
|
||||||
PACL pACL = NULL;
|
SECURITY_DESCRIPTOR descriptor;
|
||||||
|
DWORD size;
|
||||||
|
BOOL succ;
|
||||||
|
ACL acl;
|
||||||
|
|
||||||
FIXME("%p %d %p %u %p\n", hService, dwSecurityInformation,
|
FIXME("%p %d %p %u %p - semi-stub\n", hService, dwSecurityInformation,
|
||||||
lpSecurityDescriptor, cbBufSize, pcbBytesNeeded);
|
lpSecurityDescriptor, cbBufSize, pcbBytesNeeded);
|
||||||
|
|
||||||
InitializeSecurityDescriptor(lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
|
if (dwSecurityInformation != DACL_SECURITY_INFORMATION)
|
||||||
|
FIXME("information %d not supported\n", dwSecurityInformation);
|
||||||
|
|
||||||
pACL = HeapAlloc( GetProcessHeap(), 0, sizeof(ACL) );
|
InitializeSecurityDescriptor(&descriptor, SECURITY_DESCRIPTOR_REVISION);
|
||||||
InitializeAcl(pACL, sizeof(ACL), ACL_REVISION);
|
|
||||||
SetSecurityDescriptorDacl(lpSecurityDescriptor, TRUE, pACL, TRUE);
|
InitializeAcl(&acl, sizeof(ACL), ACL_REVISION);
|
||||||
return TRUE;
|
SetSecurityDescriptorDacl(&descriptor, TRUE, &acl, TRUE);
|
||||||
|
|
||||||
|
size = cbBufSize;
|
||||||
|
succ = MakeSelfRelativeSD(&descriptor, lpSecurityDescriptor, &size);
|
||||||
|
*pcbBytesNeeded = size;
|
||||||
|
return succ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue