File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -277,10 +277,10 @@ piped_processt::piped_processt(
277
277
dup2 (pipe_output[1 ], STDOUT_FILENO);
278
278
dup2 (pipe_output[1 ], STDERR_FILENO);
279
279
280
- // Create a char** for the arguments (all the contents of commandvec
281
- // except the first element, i.e. the command itself).
282
- char **args =
283
- reinterpret_cast < char **>( malloc ((commandvec.size ()) * sizeof (char *)));
280
+ // Create a char** for the arguments plus a NULL terminator (by convention,
281
+ // the first "argument" is the command itself)
282
+ char **args = reinterpret_cast < char **>(
283
+ malloc ((commandvec.size () + 1 ) * sizeof (char *)));
284
284
// Add all the arguments to the args array of char *.
285
285
unsigned long i = 0 ;
286
286
while (i < commandvec.size ())
You can’t perform that action at this time.
0 commit comments