make xmalloc_open_zipped_read_close result NUL terminated

Compat with xmalloc_open_read_close

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-12-07 00:49:55 +01:00
parent b4c11c1397
commit cfcd2399b2

View File

@ -43,8 +43,9 @@ ssize_t FAST_FUNC transformer_write(transformer_state_t *xstate, const void *buf
nwrote = -1;
goto ret;
}
xstate->mem_output_buf = xrealloc(xstate->mem_output_buf, size);
xstate->mem_output_buf = xrealloc(xstate->mem_output_buf, size + 1);
memcpy(xstate->mem_output_buf + pos, buf, bufsize);
xstate->mem_output_buf[size] = '\0';
nwrote = bufsize;
} else {
nwrote = full_write(xstate->dst_fd, buf, bufsize);