* src/job.c (child_execute_job): Allocate space for argv NULL.

This commit is contained in:
Paul Smith 2019-09-21 15:11:42 -04:00
parent bd4ce86785
commit 96285f875b

View File

@ -2399,7 +2399,7 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
for (pp = argv; *pp != NULL; ++pp)
++l;
nargv = xmalloc (sizeof (char *) * (l + 2));
nargv = xmalloc (sizeof (char *) * (l + 3));
nargv[0] = (char *)default_shell;
nargv[1] = cmd;
memcpy (&nargv[2], &argv[1], sizeof (char *) * l);