diff options
author | Steven Schubiger <stsc@refcnt.org> | 2016-03-21 16:48:09 +0100 |
---|---|---|
committer | Steven Schubiger <stsc@refcnt.org> | 2016-03-21 16:48:09 +0100 |
commit | 802d514789412c0520826cdc1081a62b6f1708c0 (patch) | |
tree | 192fbd89cff0c6767dc24dddac37ef43ee80ccac | |
parent | bf223df46d9b78354c2045170e93385efe73a7f4 (diff) | |
download | colorize-802d514789412c0520826cdc1081a62b6f1708c0.tar.gz colorize-802d514789412c0520826cdc1081a62b6f1708c0.tar.bz2 |
Terminate buffer with single NUL
-rw-r--r-- | colorize.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -745,10 +745,10 @@ read_print_stream (bool bold, const struct color **colors, const char *file, FIL size_t bytes_read; char *eol; const char *line; - memset (buf, '\0', BUF_SIZE + 1); bytes_read = fread (buf, 1, BUF_SIZE, stream); if (bytes_read != BUF_SIZE && ferror (stream)) vfprintf_fail (formats[FMT_ERROR], BUF_SIZE, "read"); + buf[bytes_read] = '\0'; line = buf; while ((eol = strpbrk (line, "\n\r"))) { |