diff --git a/src/chunk.c b/src/chunk.c index f84ab1051..d7d8501d6 100644 --- a/src/chunk.c +++ b/src/chunk.c @@ -33,7 +33,9 @@ static char *trash_buf2; * type of conversion. Two chunks and their respective buffers are alternatively * returned so that it is always possible to iterate data transformations without * losing the data being transformed. The blocks are initialized to the size of -* a standard buffer, so they should be enough for everything. +* a standard buffer, so they should be enough for everything. For convenience, +* a zero is always emitted at the beginning of the string so that it may be +* used as an empty string as well. */ struct chunk *get_trash_chunk(void) { @@ -47,6 +49,7 @@ struct chunk *get_trash_chunk(void) trash_chunk = &trash_chunk1; trash_buf = trash_buf1; } + *trash_buf = 0; chunk_init(trash_chunk, trash_buf, trash_size); return trash_chunk; }