summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-08-01 14:25:40 -0400
committerColin Walters <walters@verbum.org>2017-08-02 13:14:34 -0400
commit29ad99c9b6103853e6d6bf42fa7bff335eb114a8 (patch)
treedcea6b843d9a771eaa56e99535268ccee476661c
parenta46752edcdb176f94d4681de2df91d0a2ba97539 (diff)
downloadlibglnx-29ad99c9b6103853e6d6bf42fa7bff335eb114a8.tar.gz
console: Fix Coverity NULL deref warning
We need to handle our "empty to NULL canonicalization" before doing the length. Coverity CID: 1376570
-rw-r--r--glnx-console.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/glnx-console.c b/glnx-console.c
index 416d276..cf5409c 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -187,11 +187,12 @@ text_percent_internal (const char *text,
const guint n_spaces = sizeof (spaces) - 1;
const guint ncolumns = glnx_console_columns ();
const guint bar_min = 10;
- const guint input_textlen = text ? strlen (text) : 0;
if (text && !*text)
text = NULL;
+ const guint input_textlen = text ? strlen (text) : 0;
+
if (percentage == current_percent
&& g_strcmp0 (text, current_text) == 0)
return;