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.
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 == '"') {
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 *));