[PATCH] lib: fwts_olog: ensure buffer is null terminated

Colin King colin.king at canonical.com
Wed Feb 1 07:37:05 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

This fixes an issue detected by CoverityScan static analysis

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_olog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/src/fwts_olog.c b/src/lib/src/fwts_olog.c
index 703a6bb..59ac018 100644
--- a/src/lib/src/fwts_olog.c
+++ b/src/lib/src/fwts_olog.c
@@ -151,6 +151,7 @@ fwts_list *fwts_olog_read(fwts_framework *fw)
 		goto olog_cleanup_msglog_outfile;
 
 	read_actual = fread(buffer, 1, len, msglog_outfile_f);
+	buffer[read_actual] = '\0';
 	if (read_actual == (size_t)len) {
 		list = fwts_list_from_text(buffer);
 		free(buffer);
-- 
2.10.2




More information about the fwts-devel mailing list