diff options
-rw-r--r-- | src/htstools.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/htstools.c b/src/htstools.c index dc538ef..0894e47 100644 --- a/src/htstools.c +++ b/src/htstools.c @@ -772,6 +772,7 @@ static int hts_template_formatv(hts_template_format_buf *buf, #undef FPUTS #define FPUTC(C) do { \ if (buf->fp != NULL) { \ + assertf(buf->buffer == NULL); \ if (fputc(C, buf->fp) < 0) { \ return -1; \ } \ @@ -828,6 +829,10 @@ static int hts_template_formatv(hts_template_format_buf *buf, FPUTC(c); } } + /* Terminating NULL. */ + if (buf->buffer != NULL) { + buf->buffer[buf->offset] = 0; + } return 1; } else { return -1; |