diff options
author | David Anderson <dvander@google.com> | 2019-11-19 17:04:39 -0800 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2019-11-20 20:15:42 +0000 |
commit | 6b7a5827ed64b6f32f86e848fbcecd1760677556 (patch) | |
tree | 735e141f02117172a2af5ee7c8da6e09ca65068c /partition_tools | |
parent | c42dc84680e91d3fea8bbf83339faa30b9db94bf (diff) | |
download | extras-6b7a5827ed64b6f32f86e848fbcecd1760677556.tar.gz |
lpdumpd: Do not use stack to store arguments.
Bug: 144052321
Test: manual test
Change-Id: I700e22ef5c6c0a0c6a5f05c5bb4ea29b0077b34e
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()) { |