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

Side by Side Diff: sandbox/win/src/filesystem_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 | « no previous file | sandbox/win/src/named_pipe_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "sandbox/win/src/filesystem_policy.h" 7 #include "sandbox/win/src/filesystem_policy.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/win/scoped_handle.h" 10 #include "base/win/scoped_handle.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 if (!sandbox::SameObject(local_handle, obj_attributes->ObjectName->Buffer)) { 43 if (!sandbox::SameObject(local_handle, obj_attributes->ObjectName->Buffer)) {
44 // The handle points somewhere else. Fail the operation. 44 // The handle points somewhere else. Fail the operation.
45 ::CloseHandle(local_handle); 45 ::CloseHandle(local_handle);
46 return STATUS_ACCESS_DENIED; 46 return STATUS_ACCESS_DENIED;
47 } 47 }
48 48
49 if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, 49 if (!::DuplicateHandle(::GetCurrentProcess(), local_handle,
50 target_process, target_file_handle, 0, FALSE, 50 target_process, target_file_handle, 0, FALSE,
51 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { 51 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) {
52 ::CloseHandle(local_handle);
53 return STATUS_ACCESS_DENIED; 52 return STATUS_ACCESS_DENIED;
54 } 53 }
55 return STATUS_SUCCESS; 54 return STATUS_SUCCESS;
56 } 55 }
57 56
58 } // namespace. 57 } // namespace.
59 58
60 namespace sandbox { 59 namespace sandbox {
61 60
62 bool FileSystemPolicy::GenerateRules(const wchar_t* name, 61 bool FileSystemPolicy::GenerateRules(const wchar_t* name,
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 377
379 bool reparsed = false; 378 bool reparsed = false;
380 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed)) 379 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed))
381 return false; 380 return false;
382 381
383 // We can't process reparsed file. 382 // We can't process reparsed file.
384 return !reparsed; 383 return !reparsed;
385 } 384 }
386 385
387 } // namespace sandbox 386 } // namespace sandbox
OLDNEW
« no previous file with comments | « no previous file | sandbox/win/src/named_pipe_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698