Commit f02661f8 authored by Nicholas Verne's avatar Nicholas Verne Committed by Commit Bot

Fix up terminal args passed to crosh in its args array.

When Crostini users invoke x-terminal-emulator $CMD, the contents of CMD
are eventually passed by CrostiniManager in an args[] array to crosh as part
of its URL.

Fixed in this CL: incorrect usage of vector<StringPiece>.
We were adding more pieces in line 1065 which were derived from temporaries
(return values of net::Escape...). The temporaries were thrown away but the
pieces still pointed to the same memory and we sent nonsense to
base::JoinString().

Bug: 898111
Change-Id: If5d3ffcb6ab28d01698ee48cd7fd3d2230381f95
Reviewed-on: https://chromium-review.googlesource.com/c/1341282
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarMike Frysinger <vapier@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609539}
parent b655c5a6
...@@ -1057,8 +1057,8 @@ GURL CrostiniManager::GenerateVshInCroshUrl( ...@@ -1057,8 +1057,8 @@ GURL CrostiniManager::GenerateVshInCroshUrl(
CryptohomeIdForProfile(profile).c_str()), CryptohomeIdForProfile(profile).c_str()),
false); false);
std::vector<base::StringPiece> pieces = { std::vector<std::string> pieces = {vsh_crosh, vm_name_param,
vsh_crosh, vm_name_param, container_name_param, owner_id_param}; container_name_param, owner_id_param};
if (!terminal_args.empty()) { if (!terminal_args.empty()) {
// Separates the command args from the args we are passing into the // Separates the command args from the args we are passing into the
// terminal to be executed. // terminal to be executed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment