| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_dispatcher.h" | 5 #include "sandbox/win/src/named_pipe_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 | 9 |
| 10 #include "sandbox/win/src/crosscall_client.h" | 10 #include "sandbox/win/src/crosscall_client.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 base::string16* name, | 49 base::string16* name, |
| 50 uint32 open_mode, | 50 uint32 open_mode, |
| 51 uint32 pipe_mode, | 51 uint32 pipe_mode, |
| 52 uint32 max_instances, | 52 uint32 max_instances, |
| 53 uint32 out_buffer_size, | 53 uint32 out_buffer_size, |
| 54 uint32 in_buffer_size, | 54 uint32 in_buffer_size, |
| 55 uint32 default_timeout) { | 55 uint32 default_timeout) { |
| 56 ipc->return_info.win32_result = ERROR_ACCESS_DENIED; | 56 ipc->return_info.win32_result = ERROR_ACCESS_DENIED; |
| 57 ipc->return_info.handle = INVALID_HANDLE_VALUE; | 57 ipc->return_info.handle = INVALID_HANDLE_VALUE; |
| 58 | 58 |
| 59 std::vector<base::string16> paths; | 59 base::StringPiece16 dotdot(L".."); |
| 60 std::vector<base::string16> innerpaths; | |
| 61 base::SplitString(*name, '/', &paths); | |
| 62 | 60 |
| 63 for (std::vector<base::string16>::const_iterator iter = paths.begin(); | 61 for (const base::StringPiece16& path : base::SplitStringPiece( |
| 64 iter != paths.end(); ++iter) { | 62 *name, base::string16(1, '/'), |
| 65 base::SplitString(*iter, '\\', &innerpaths); | 63 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| 66 for (std::vector<base::string16>::const_iterator iter2 = innerpaths.begin(); | 64 for (const base::StringPiece16& inner : base::SplitStringPiece( |
| 67 iter2 != innerpaths.end(); ++iter2) { | 65 path, base::string16(1, '\\'), |
| 68 if (*iter2 == L"..") | 66 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { |
| 67 if (inner == dotdot) |
| 69 return true; | 68 return true; |
| 70 } | 69 } |
| 71 } | 70 } |
| 72 | 71 |
| 73 const wchar_t* pipe_name = name->c_str(); | 72 const wchar_t* pipe_name = name->c_str(); |
| 74 CountedParameterSet<NameBased> params; | 73 CountedParameterSet<NameBased> params; |
| 75 params[NameBased::NAME] = ParamPickerMake(pipe_name); | 74 params[NameBased::NAME] = ParamPickerMake(pipe_name); |
| 76 | 75 |
| 77 EvalResult eval = policy_base_->EvalPolicy(IPC_CREATENAMEDPIPEW_TAG, | 76 EvalResult eval = policy_base_->EvalPolicy(IPC_CREATENAMEDPIPEW_TAG, |
| 78 params.GetBase()); | 77 params.GetBase()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 out_buffer_size, | 93 out_buffer_size, |
| 95 in_buffer_size, | 94 in_buffer_size, |
| 96 default_timeout, &pipe); | 95 default_timeout, &pipe); |
| 97 | 96 |
| 98 ipc->return_info.win32_result = ret; | 97 ipc->return_info.win32_result = ret; |
| 99 ipc->return_info.handle = pipe; | 98 ipc->return_info.handle = pipe; |
| 100 return true; | 99 return true; |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace sandbox | 102 } // namespace sandbox |
| OLD | NEW |