Cygwin: fork: restrict parent handle perms and drop handle after use

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2019-01-27 13:15:15 +01:00
parent 0fb497165f
commit 69cc7a0686
3 changed files with 7 additions and 3 deletions

View File

@ -814,8 +814,9 @@ child_info::child_info (unsigned in_cb, child_info_types chtype,
allow the child to duplicate handles from the parent to itself. */
parent = NULL;
if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
GetCurrentProcess (), &parent, 0, true,
DUPLICATE_SAME_ACCESS))
GetCurrentProcess (), &parent,
PROCESS_DUP_HANDLE | PROCESS_VM_READ
| PROCESS_QUERY_LIMITED_INFORMATION, TRUE, 0))
system_printf ("couldn't create handle to myself for child, %E");
}