Sat, 01 Feb 2025 16:59:45 +0100
fix accidental use of VLA
src/process.cpp | file | annotate | diff | comparison | revisions |
--- a/src/process.cpp Sat Feb 01 16:40:24 2025 +0100 +++ b/src/process.cpp Sat Feb 01 16:59:45 2025 +0100 @@ -41,6 +41,10 @@ } int process::exec(std::vector<std::string> args, bool capture) { + if (args.size() > 14) { + fputs("Too many arguments to sub-process.\n", stderr); + return -1; + } m_output.clear(); // fd-pair for the pipe @@ -61,7 +65,7 @@ close(pipefd[0]); // create the execv argument list - char *argv[args.size() + 2] = {}; + char *argv[16]; auto slash = m_path.find_last_of('/'); if (slash == std::string::npos) { argv[0] = m_path.data();