Allocate one extra byte for zero termination

This commit is contained in:
Andreas Öman 2008-05-02 15:45:19 +00:00
parent 9f2da1c94c
commit d07b22f35c

View file

@ -210,7 +210,7 @@ spawn_and_store_stdout(const char *prog, char *const argv[], char **outp)
return 0;
}
outbuf = malloc(totalsize);
outbuf = malloc(totalsize + 1);
r = 0;
while((b = TAILQ_FIRST(&bufs)) != NULL) {
memcpy(outbuf + r, b->sob_buf, b->sob_size);