aboutsummaryrefslogtreecommitdiffstats
path: root/extcap.c
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2022-08-15 10:51:20 +0200
committerTomasz Moń <desowin@gmail.com>2022-08-16 20:53:22 +0200
commitc6ef99f006b64ebfe182936b263900b8119b5334 (patch)
treec7ea0828de1265445647dc128b7b161d23b71b61 /extcap.c
parent3c3d7156282dfe8db298eba29dd67cb218965901 (diff)
win32-utils: Explicitly list inherited handles
Windows processes inherit all inheritable handles when a new process is created using CreateProcess() with bInheritHandles set to TRUE. This can lead to undesired object lifetime extension. That is, the child process will keep ineritable handles alive even if it does not use them. Up to Windows Vista it was not possible explicitly list handles that should be inherited. Wireshark no longer works on Windows releases earlier than Vista, so use the new API without checking Windows version. Require all callers to win32_create_process() to pass in the list of handles to inherit. Set the listed handles as inheritable shortly before calling CreateProcess() and set them as not inheritable shortly after the process is created. This minimizes possibility for other callers (especially in 3rd party libraries) to inherit handles by accident. Do not terminate mmdbresolve process on exit. Instead rely on process exit when EOF is received on standard input. Previously the EOF was never received because mmdbresolve inherited both ends of standard input pipe, i.e. the fact that Wireshark closed the write end was not observed by mmdbresolve because mmdbresolve kept write handle the standard input pipe open.
Diffstat (limited to 'extcap.c')
-rw-r--r--extcap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extcap.c b/extcap.c
index 9834c7dc2d..b553127c58 100644
--- a/extcap.c
+++ b/extcap.c
@@ -1623,7 +1623,7 @@ static gboolean extcap_create_pipe(const gchar *ifname, gchar **fifo, HANDLE *ha
/* Security struct to enable Inheritable HANDLE */
memset(&security, 0, sizeof(SECURITY_ATTRIBUTES));
security.nLength = sizeof(SECURITY_ATTRIBUTES);
- security.bInheritHandle = TRUE;
+ security.bInheritHandle = FALSE;
security.lpSecurityDescriptor = NULL;
/* create a namedPipe */