Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
7e1c886f
Commit
7e1c886f
authored
Jul 07, 2015
by
André Hentschel
Committed by
Alexandre Julliard
Jul 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Randomize security cookie when available.
parent
eecd136c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
virtual.c
dlls/ntdll/virtual.c
+20
-0
No files found.
dlls/ntdll/virtual.c
View file @
7e1c886f
...
...
@@ -1067,6 +1067,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
IMAGE_SECTION_HEADER
sections
[
96
];
IMAGE_SECTION_HEADER
*
sec
;
IMAGE_DATA_DIRECTORY
*
imports
;
IMAGE_LOAD_CONFIG_DIRECTORY
*
loadcfg
;
ULONG
loadcfg_size
;
NTSTATUS
status
=
STATUS_CONFLICTING_ADDRESSES
;
int
i
;
off_t
pos
;
...
...
@@ -1278,6 +1280,24 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
}
}
/* randomize security cookie */
loadcfg
=
RtlImageDirectoryEntryToData
(
(
HMODULE
)
ptr
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
,
&
loadcfg_size
);
if
(
loadcfg
&&
loadcfg_size
>=
sizeof
(
*
loadcfg
))
{
static
ULONG
seed
;
ULONG_PTR
*
cookie
=
(
ULONG_PTR
*
)
loadcfg
->
SecurityCookie
;
if
(
!
seed
)
seed
=
NtGetTickCount
()
^
GetCurrentProcessId
();
if
(
cookie
)
{
*
cookie
=
RtlRandom
(
&
seed
);
if
(
sizeof
(
ULONG_PTR
)
>
sizeof
(
ULONG
))
/* fill up, but keep the highest word clear */
*
cookie
^=
(
ULONG_PTR
)
RtlRandom
(
&
seed
)
<<
16
;
}
}
/* set the image protections */
VIRTUAL_SetProt
(
view
,
ptr
,
ROUND_SIZE
(
0
,
header_size
),
VPROT_COMMITTED
|
VPROT_READ
);
...
...
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