diff options
author | Tomasz Moń <desowin@gmail.com> | 2014-10-03 19:01:46 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2014-10-03 20:29:12 +0000 |
commit | a6988b451f88aa3a2d66d0f59f6a72180fea249c (patch) | |
tree | 221732a2499b01e8979a8242420034216b7adc4c /extcap.c | |
parent | 8b7d27c8be1418642fbf089dfdb295a2fc5e5211 (diff) | |
download | wireshark-a6988b451f88aa3a2d66d0f59f6a72180fea249c.tar.gz wireshark-a6988b451f88aa3a2d66d0f59f6a72180fea249c.tar.bz2 wireshark-a6988b451f88aa3a2d66d0f59f6a72180fea249c.zip |
Fix memory leak and heap corruption on Windows.
LPSECURITY_ATTRIBUTES is type definition for pointer to SECURITY_ATTRIBUTES
structure.
Change-Id: I94a835bfd8f7eb76c808fac8286ca3f2db9b19c3
Reviewed-on: https://code.wireshark.org/review/4449
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'extcap.c')
-rw-r--r-- | extcap.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -520,17 +520,17 @@ gboolean extcap_create_pipe(char ** fifo) gchar *pipename = NULL; - LPSECURITY_ATTRIBUTES security = NULL; + SECURITY_ATTRIBUTES security; /* create pipename */ current_time = time(NULL); strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(¤t_time)); pipename = g_strconcat ( "\\\\.\\pipe\\", EXTCAP_PIPE_PREFIX, "_", timestr, NULL ); /* Security struct to enable Inheritable HANDLE */ - security = (LPSECURITY_ATTRIBUTES)g_malloc0(sizeof(LPSECURITY_ATTRIBUTES)); - security->nLength = sizeof(LPSECURITY_ATTRIBUTES); - security->bInheritHandle = TRUE; - security->lpSecurityDescriptor = NULL; + memset(&security, 0, sizeof(SECURITY_ATTRIBUTES)); + security.nLength = sizeof(SECURITY_ATTRIBUTES); + security.bInheritHandle = TRUE; + security.lpSecurityDescriptor = NULL; /* create a namedPipe*/ pipe_h = CreateNamedPipe( @@ -539,7 +539,7 @@ gboolean extcap_create_pipe(char ** fifo) PIPE_TYPE_MESSAGE| PIPE_READMODE_MESSAGE | PIPE_WAIT, 5, 65536, 65536, 300, - security); + &security); if (pipe_h == INVALID_HANDLE_VALUE) { |