diff options
author | David Anderson <dvander@google.com> | 2019-11-21 21:39:28 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-11-21 21:39:28 +0000 |
commit | 46038c20027cd426dbcd54d907acf4396823925a (patch) | |
tree | cdc00c66294a8542b1a7fef1c32c18a4bfbf28d6 /partition_tools | |
parent | 2e61a7758c2ebb01627e50b7447abd9c7918d7de (diff) | |
parent | 6b7a5827ed64b6f32f86e848fbcecd1760677556 (diff) | |
download | extras-46038c20027cd426dbcd54d907acf4396823925a.tar.gz |
Merge "lpdumpd: Do not use stack to store arguments."
Diffstat (limited to 'partition_tools')
-rw-r--r-- | partition_tools/lpdumpd.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/partition_tools/lpdumpd.cc b/partition_tools/lpdumpd.cc index 6110f337..7717e115 100644 --- a/partition_tools/lpdumpd.cc +++ b/partition_tools/lpdumpd.cc @@ -40,18 +40,15 @@ class Lpdump : public BnLpdump { virtual ~Lpdump() = default; Status run(const std::vector<std::string>& args, std::string* aidl_return) override { - if (args.size() > std::numeric_limits<int>::max()) { - return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT); - } - std::vector<std::string> m_args = args; - char* argv[m_args.size()]; - for (size_t i = 0; i < m_args.size(); ++i) { - argv[i] = m_args[i].data(); + std::vector<char*> local_argv; + std::vector<std::string> local_args = args; + for (auto& arg : local_args) { + local_argv.push_back(arg.data()); } LOG(DEBUG) << "Dumping with args: " << base::Join(args, " "); std::stringstream output; std::stringstream error; - int ret = LpdumpMain((int)m_args.size(), argv, output, error); + int ret = LpdumpMain((int)local_argv.size(), local_argv.data(), output, error); std::string error_str = error.str(); if (ret == 0) { if (!error_str.empty()) { |