Fix memory overflow error.

This commit is contained in:
carl 2019-03-26 00:58:56 +08:00
parent 415ec163a7
commit a09e40cba3

View file

@ -865,7 +865,8 @@ static int runvec(struct arglist *vec, char *outp)
} }
if(outp != NULL) if(outp != NULL)
{ {
redirect = alloc(strlen(outp)+sizeof(char)*2); /* Don't forget the null character. */
redirect = alloc(strlen(outp)+sizeof(char)*3);
strcpy(redirect,"1>"); strcpy(redirect,"1>");
strcat(redirect,outp); strcat(redirect,outp);
append(vec,redirect); append(vec,redirect);