summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-28 19:03:07 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-28 19:03:07 +0000
commit3864a4538872269d9bdbeda5cb88bee80f2a07cc (patch)
tree75442c35b29e03460469926a08d2f87aaf4b1aae /src
parent5e248cc4e37a388aed8b14c88be92c2805de0256 (diff)
Fixed NULL terminated string.
Diffstat (limited to 'src')
-rw-r--r--src/htstools.c5
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;