diff options
author | rvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-28 05:16:59 +0000 |
---|---|---|
committer | rvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-28 05:16:59 +0000 |
commit | 5be06e403789b537097560fef594000626a61997 (patch) | |
tree | 7921ffcc481aa118a901086229fda96519973757 /chrome/browser/extensions/api/messaging/native_process_launcher_win.cc | |
parent | 96798670fd3a04b7bf820eb39c7fdbde25414e53 (diff) | |
download | chromium_src-5be06e403789b537097560fef594000626a61997.zip chromium_src-5be06e403789b537097560fef594000626a61997.tar.gz chromium_src-5be06e403789b537097560fef594000626a61997.tar.bz2 |
Base: Remove Receive() from ScopedHandle.
In general, the OS API contract doesn't guarantee that output variables are
not modified on failure, so a Reeceive pattern is fundamentally insecure.
BUG=318531
TEST=current tests
tbr'ing owners for the consumers.
TBR=jvoung@chromium.org, thakis@chromium.org, sergeyu@chromium.org, grt@chromium.org, gene@chromium.org, youngki@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=237459
Review URL: https://codereview.chromium.org/71013004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/messaging/native_process_launcher_win.cc')
-rw-r--r-- | chrome/browser/extensions/api/messaging/native_process_launcher_win.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc index fd7345c..31fbdc8 100644 --- a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc +++ b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc @@ -136,7 +136,7 @@ bool NativeProcessLauncher::LaunchNativeProcess( base::LaunchOptions options; options.start_hidden = true; - base::ProcessHandle cmd_handle; + base::win::ScopedHandle cmd_handle; if (!base::LaunchProcess(command.c_str(), options, &cmd_handle)) { LOG(ERROR) << "Error launching process " << command_line.GetProgram().MaybeAsASCII(); @@ -148,14 +148,13 @@ bool NativeProcessLauncher::LaunchNativeProcess( bool stdin_connected = ConnectNamedPipe(stdin_pipe.Get(), NULL) ? TRUE : GetLastError() == ERROR_PIPE_CONNECTED; if (!stdout_connected || !stdin_connected) { - base::KillProcess(cmd_handle, 0, false); - base::CloseProcessHandle(cmd_handle); + base::KillProcess(cmd_handle.Get(), 0, false); LOG(ERROR) << "Failed to connect IO pipes when starting " << command_line.GetProgram().MaybeAsASCII(); return false; } - *process_handle = cmd_handle; + *process_handle = cmd_handle.Take(); *read_file = stdout_pipe.Take(); *write_file = stdin_pipe.Take(); |