Allocate one extra byte for zero termination
This commit is contained in:
parent
9f2da1c94c
commit
d07b22f35c
1 changed files with 1 additions and 1 deletions
2
spawn.c
2
spawn.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue