Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: sandbox/win/src/named_pipe_policy.cc

Issue 13912024: Fix small race in the sandbox (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/win/src/filesystem_policy.cc ('k') | sandbox/win/src/registry_policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/win/src/named_pipe_policy.h" 5 #include "sandbox/win/src/named_pipe_policy.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "sandbox/win/src/ipc_tags.h" 9 #include "sandbox/win/src/ipc_tags.h"
10 #include "sandbox/win/src/policy_engine_opcodes.h" 10 #include "sandbox/win/src/policy_engine_opcodes.h"
(...skipping 10 matching lines...) Expand all
21 DWORD in_buffer_size, DWORD default_timeout, 21 DWORD in_buffer_size, DWORD default_timeout,
22 LPSECURITY_ATTRIBUTES security_attributes) { 22 LPSECURITY_ATTRIBUTES security_attributes) {
23 HANDLE pipe = ::CreateNamedPipeW(pipe_name, open_mode, pipe_mode, 23 HANDLE pipe = ::CreateNamedPipeW(pipe_name, open_mode, pipe_mode,
24 max_instances, out_buffer_size, 24 max_instances, out_buffer_size,
25 in_buffer_size, default_timeout, 25 in_buffer_size, default_timeout,
26 security_attributes); 26 security_attributes);
27 if (INVALID_HANDLE_VALUE == pipe) 27 if (INVALID_HANDLE_VALUE == pipe)
28 return pipe; 28 return pipe;
29 29
30 HANDLE new_pipe; 30 HANDLE new_pipe;
31 if (!::DuplicateHandle(::GetCurrentProcess(), pipe, target_process, &new_pipe, 31 if (!::DuplicateHandle(::GetCurrentProcess(), pipe,
32 0, FALSE, DUPLICATE_CLOSE_SOURCE | 32 target_process, &new_pipe,
33 DUPLICATE_SAME_ACCESS)) { 33 0, FALSE,
34 ::CloseHandle(pipe); 34 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) {
35 return INVALID_HANDLE_VALUE; 35 return INVALID_HANDLE_VALUE;
36 } 36 }
37 37
38 return new_pipe; 38 return new_pipe;
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 namespace sandbox { 43 namespace sandbox {
44 44
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 out_buffer_size, in_buffer_size, 77 out_buffer_size, in_buffer_size,
78 default_timeout, NULL); 78 default_timeout, NULL);
79 79
80 if (INVALID_HANDLE_VALUE == *pipe) 80 if (INVALID_HANDLE_VALUE == *pipe)
81 return ERROR_ACCESS_DENIED; 81 return ERROR_ACCESS_DENIED;
82 82
83 return ERROR_SUCCESS; 83 return ERROR_SUCCESS;
84 } 84 }
85 85
86 } // namespace sandbox 86 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/filesystem_policy.cc ('k') | sandbox/win/src/registry_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698