Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
966c5dff
Commit
966c5dff
authored
Mar 28, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Improve parameter validation in RtlAddAce.
parent
6c3aac3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
security.c
dlls/advapi32/tests/security.c
+46
-0
sec.c
dlls/ntdll/sec.c
+3
-1
No files found.
dlls/advapi32/tests/security.c
View file @
966c5dff
...
...
@@ -5568,6 +5568,51 @@ static void test_AdjustTokenPrivileges(void)
CloseHandle
(
token
);
}
static
void
test_AddAce
(
void
)
{
static
SID
const
sidWorld
=
{
SID_REVISION
,
1
,
{
SECURITY_WORLD_SID_AUTHORITY
}
,
{
SECURITY_WORLD_RID
}
};
char
acl_buf
[
1024
],
ace_buf
[
256
];
ACCESS_ALLOWED_ACE
*
ace
=
(
ACCESS_ALLOWED_ACE
*
)
ace_buf
;
PACL
acl
=
(
PACL
)
acl_buf
;
BOOL
ret
;
memset
(
ace
,
0
,
sizeof
(
ace_buf
));
ace
->
Header
.
AceType
=
ACCESS_ALLOWED_ACE_TYPE
;
ace
->
Header
.
AceSize
=
sizeof
(
ACCESS_ALLOWED_ACE
)
-
sizeof
(
DWORD
)
+
sizeof
(
SID
);
memcpy
(
&
ace
->
SidStart
,
&
sidWorld
,
sizeof
(
sidWorld
));
ret
=
InitializeAcl
(
acl
,
sizeof
(
acl_buf
),
ACL_REVISION2
);
ok
(
ret
,
"InitializeAcl failed: %d
\n
"
,
GetLastError
());
ret
=
AddAce
(
acl
,
ACL_REVISION1
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ret
=
AddAce
(
acl
,
ACL_REVISION2
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ret
=
AddAce
(
acl
,
ACL_REVISION3
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ok
(
acl
->
AclRevision
==
ACL_REVISION3
,
"acl->AclRevision = %d
\n
"
,
acl
->
AclRevision
);
ret
=
AddAce
(
acl
,
ACL_REVISION4
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ok
(
acl
->
AclRevision
==
ACL_REVISION4
,
"acl->AclRevision = %d
\n
"
,
acl
->
AclRevision
);
ret
=
AddAce
(
acl
,
ACL_REVISION1
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ok
(
acl
->
AclRevision
==
ACL_REVISION4
,
"acl->AclRevision = %d
\n
"
,
acl
->
AclRevision
);
ret
=
AddAce
(
acl
,
ACL_REVISION2
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ret
=
AddAce
(
acl
,
MIN_ACL_REVISION
-
1
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
/* next test succeededs but corrupts ACL */
ret
=
AddAce
(
acl
,
MAX_ACL_REVISION
+
1
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
ret
,
"AddAce failed: %d
\n
"
,
GetLastError
());
ok
(
acl
->
AclRevision
==
MAX_ACL_REVISION
+
1
,
"acl->AclRevision = %d
\n
"
,
acl
->
AclRevision
);
SetLastError
(
0xdeadbeef
);
ret
=
AddAce
(
acl
,
ACL_REVISION1
,
MAXDWORD
,
ace
,
ace
->
Header
.
AceSize
);
ok
(
!
ret
,
"AddAce succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"GetLastError() = %d
\n
"
,
GetLastError
());
}
START_TEST
(
security
)
{
init
();
...
...
@@ -5609,4 +5654,5 @@ START_TEST(security)
test_TokenIntegrityLevel
();
test_default_dacl_owner_sid
();
test_AdjustTokenPrivileges
();
test_AddAce
();
}
dlls/ntdll/sec.c
View file @
966c5dff
...
...
@@ -1167,7 +1167,7 @@ NTSTATUS WINAPI RtlAddAce(
PACE_HEADER
ace
,
targetace
;
int
nrofaces
;
if
(
acl
->
AclRevision
!=
ACL_REVISION
)
if
(
!
RtlValidAcl
(
acl
)
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
RtlFirstFreeAce
(
acl
,
&
targetace
))
return
STATUS_INVALID_PARAMETER
;
...
...
@@ -1180,6 +1180,8 @@ NTSTATUS WINAPI RtlAddAce(
return
STATUS_INVALID_PARAMETER
;
memcpy
(
targetace
,
acestart
,
acelen
);
acl
->
AceCount
+=
nrofaces
;
if
(
rev
>
acl
->
AclRevision
)
acl
->
AclRevision
=
rev
;
return
STATUS_SUCCESS
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment