summaryrefslogtreecommitdiff
path: root/libs/pbd/system_exec.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2014-05-18 20:49:58 +0100
committerColin Fletcher <colin.m.fletcher@googlemail.com>2014-05-18 20:49:58 +0100
commit7c4259133d4ca965f7aed5cbb419d75125de6bef (patch)
treea3bb1334447071e9bf69cef278008acbc6310913 /libs/pbd/system_exec.cc
parent57077093b706c5938f9fd70f70d031cae2c59217 (diff)
SystemExec: copy last argument from command line to argv[]
Make sure to copy any part of the command line after the last delimiter to argv[] when creating a SystemExec with an escaped command line.
Diffstat (limited to 'libs/pbd/system_exec.cc')
-rw-r--r--libs/pbd/system_exec.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc
index f270364660..bf02fd7254 100644
--- a/libs/pbd/system_exec.cc
+++ b/libs/pbd/system_exec.cc
@@ -201,7 +201,7 @@ SystemExec::make_argp_escaped(std::string command, const std::map<char, std::str
argp = (char **) malloc(sizeof(char *));
- for (i = 0; i < command.length(); i++) {
+ for (i = 0; i <= command.length(); i++) { // include terminating '\0'
char c = command.c_str()[i];
if (inquotes) {
if (c == '"') {
@@ -244,6 +244,7 @@ SystemExec::make_argp_escaped(std::string command, const std::map<char, std::str
break;
case ' ' :
case '\t':
+ case '\0':
if (arg.length() > 0) {
// if there wasn't already a space or tab, start a new parameter
argp = (char **) realloc(argp, (n + 2) * sizeof(char *));