Skip to content

Commit 8519f1a

Browse files
Fixing tabs replaced to spaces
1 parent 75ef377 commit 8519f1a

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

cpp/ql/src/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ SECURITY_ATTRIBUTES SA;
33

44
if (!InitializeSecurityDescriptor(&pSD, SECURITY_DESCRIPTOR_REVISION))
55
{
6-
// error handling
6+
// error handling
77
}
8-
if (!SetSecurityDescriptorDacl(&pSD,
9-
TRUE, // bDaclPresent - this value indicates the presence of a DACL in the security descriptor
10-
NULL, // pDacl - the pDacl parameter does not point to a DACL. All access will be allowed
11-
FALSE))
8+
if (!SetSecurityDescriptorDacl(&pSD,
9+
TRUE, // bDaclPresent - this value indicates the presence of a DACL in the security descriptor
10+
NULL, // pDacl - the pDacl parameter does not point to a DACL. All access will be allowed
11+
FALSE))
1212
{
13-
// error handling
13+
// error handling
1414
}
Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,91 @@
11
typedef unsigned long DWORD;
2-
typedef unsigned long ULONG;
2+
typedef unsigned long ULONG;
33
typedef unsigned char BYTE;
44
typedef unsigned short WORD;
55
typedef int BOOL;
6-
typedef void *PVOID;
6+
typedef void *PVOID;
77
#define TRUE 1
8-
#define FALSE 0
8+
#define FALSE 0
99
#define ERROR_SUCCESS 0L
10-
#define NULL 0
10+
#define NULL 0
1111

1212
typedef PVOID PSECURITY_DESCRIPTOR;
1313

1414
typedef struct _ACL {
15-
BYTE AclRevision;
16-
BYTE Sbz1;
17-
WORD AclSize;
18-
WORD AceCount;
19-
WORD Sbz2;
15+
BYTE AclRevision;
16+
BYTE Sbz1;
17+
WORD AclSize;
18+
WORD AceCount;
19+
WORD Sbz2;
2020
} ACL;
2121
typedef ACL *PACL;
2222

2323
typedef enum _ACCESS_MODE
2424
{
25-
NOT_USED_ACCESS = 0,
26-
GRANT_ACCESS,
27-
SET_ACCESS,
28-
DENY_ACCESS,
29-
REVOKE_ACCESS,
30-
SET_AUDIT_SUCCESS,
31-
SET_AUDIT_FAILURE
25+
NOT_USED_ACCESS = 0,
26+
GRANT_ACCESS,
27+
SET_ACCESS,
28+
DENY_ACCESS,
29+
REVOKE_ACCESS,
30+
SET_AUDIT_SUCCESS,
31+
SET_AUDIT_FAILURE
3232
} ACCESS_MODE;
3333

3434
typedef int TRUSTEE_W;
3535

3636
typedef struct _EXPLICIT_ACCESS_W
3737
{
38-
DWORD grfAccessPermissions;
39-
ACCESS_MODE grfAccessMode;
40-
DWORD grfInheritance;
41-
TRUSTEE_W Trustee;
38+
DWORD grfAccessPermissions;
39+
ACCESS_MODE grfAccessMode;
40+
DWORD grfInheritance;
41+
TRUSTEE_W Trustee;
4242
} EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W, EXPLICIT_ACCESSW, *PEXPLICIT_ACCESSW;
4343

4444
BOOL
4545
SetSecurityDescriptorDacl(
46-
PSECURITY_DESCRIPTOR pSecurityDescriptor,
47-
BOOL bDaclPresent,
48-
PACL pDacl,
49-
BOOL bDaclDefaulted
46+
PSECURITY_DESCRIPTOR pSecurityDescriptor,
47+
BOOL bDaclPresent,
48+
PACL pDacl,
49+
BOOL bDaclDefaulted
5050
) {
51-
return TRUE;
51+
return TRUE;
5252
}
5353

5454
DWORD SetEntriesInAcl(
55-
ULONG cCountOfExplicitEntries,
56-
PEXPLICIT_ACCESS_W pListOfExplicitEntries,
57-
PACL OldAcl,
58-
PACL *NewAcl
55+
ULONG cCountOfExplicitEntries,
56+
PEXPLICIT_ACCESS_W pListOfExplicitEntries,
57+
PACL OldAcl,
58+
PACL *NewAcl
5959
)
6060
{
61-
*NewAcl = (PACL)0xFFFFFF;
62-
return ERROR_SUCCESS;
61+
*NewAcl = (PACL)0xFFFFFF;
62+
return ERROR_SUCCESS;
6363
}
6464

6565
void Test()
6666
{
67-
PSECURITY_DESCRIPTOR pSecurityDescriptor;
68-
BOOL b;
69-
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
70-
TRUE, // Dacl Present
71-
NULL, // NULL pointer to DACL == BUG
72-
FALSE);
67+
PSECURITY_DESCRIPTOR pSecurityDescriptor;
68+
BOOL b;
69+
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
70+
TRUE, // Dacl Present
71+
NULL, // NULL pointer to DACL == BUG
72+
FALSE);
7373

74-
PACL pDacl = NULL;
75-
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
76-
TRUE, // Dacl Present
77-
pDacl, // NULL pointer to DACL == BUG
78-
FALSE);
74+
PACL pDacl = NULL;
75+
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
76+
TRUE, // Dacl Present
77+
pDacl, // NULL pointer to DACL == BUG
78+
FALSE);
7979

80-
SetEntriesInAcl(0, NULL, NULL, &pDacl);
81-
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
82-
TRUE, // Dacl Present
83-
pDacl, // Should have been set by SetEntriesInAcl ==> should not be flagged
84-
FALSE);
80+
SetEntriesInAcl(0, NULL, NULL, &pDacl);
81+
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
82+
TRUE, // Dacl Present
83+
pDacl, // Should have been set by SetEntriesInAcl ==> should not be flagged
84+
FALSE);
8585

86-
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
87-
FALSE, // Dacl is not Present
88-
NULL, // DACL is going to be removed from security descriptor. Default/inherited access ==> should not be flagged
89-
FALSE);
86+
b = SetSecurityDescriptorDacl(pSecurityDescriptor,
87+
FALSE, // Dacl is not Present
88+
NULL, // DACL is going to be removed from security descriptor. Default/inherited access ==> should not be flagged
89+
FALSE);
9090

9191
}

0 commit comments

Comments
 (0)