From 07ed39108045a9587e5cdf8cedb818c18d9999f7 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Mon, 22 Aug 2011 14:37:39 +0100 Subject: [PATCH] Fix incorrect buffer size calculation in ProcessUtils::runAsyncUnix() The buffer needs one entry for the executable path, args.size() args for the supplied arguments and one further entry for the null terminator. --- src/ProcessUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProcessUtils.cpp b/src/ProcessUtils.cpp index 824378a..7665461 100644 --- a/src/ProcessUtils.cpp +++ b/src/ProcessUtils.cpp @@ -252,7 +252,7 @@ int ProcessUtils::runAsyncUnix(const std::string& executable, if (child == 0) { // in child process - char** argBuffer = new char*[args.size() + 1]; + char** argBuffer = new char*[args.size() + 2]; argBuffer[0] = strdup(executable.c_str()); int i = 1; for (std::list::const_iterator iter = args.begin(); iter != args.end(); iter++)