From 1893c1ff748ee39f33e7eef1c833ce47897ff95d Mon Sep 17 00:00:00 2001
From: Philip Withnall <withnall@endlessm.com>
Date: Tue, 15 Aug 2017 12:04:45 +0100
Subject: [PATCH] glnx-console: Add missing NULL check before writing out text
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It’s possible that text is NULL on this path.

Coverity CID: 1376570

Signed-off-by: Philip Withnall <withnall@endlessm.com>
---
 glnx-console.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/glnx-console.c b/glnx-console.c
index cf5409c91..785f34806 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -222,7 +222,8 @@ text_percent_internal (const char *text,
 
   if (percentage == -1)
     {
-      fwrite (text, 1, input_textlen, stdout);
+      if (text != NULL)
+        fwrite (text, 1, input_textlen, stdout);
 
       /* Overwrite remaining space, if any */
       if (ncolumns > input_textlen)
-- 
GitLab