[PATCH] fwts_log_plaintext: check for null pointer
Colin King
colin.king at canonical.com
Mon Jun 10 10:54:19 UTC 2019
From: Colin Ian King <colin.king at canonical.com>
The pointer 'lines' can potentially be null, so check for this.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_log_plaintext.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/lib/src/fwts_log_plaintext.c b/src/lib/src/fwts_log_plaintext.c
index 1151603e..a8cbfb53 100644
--- a/src/lib/src/fwts_log_plaintext.c
+++ b/src/lib/src/fwts_log_plaintext.c
@@ -130,6 +130,8 @@ static int fwts_log_print_plaintext(
else
lines = fwts_format_text(tmpbuf + header_len, log_file->line_width - header_len);
+ if (!lines)
+ return 0;
len = n;
fwts_list_foreach(item, lines) {
--
2.20.1
More information about the fwts-devel
mailing list