[libglnx] console: Fix Coverity NULL deref warning
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx] console: Fix Coverity NULL deref warning
- Date: Wed, 2 Aug 2017 17:14:44 +0000 (UTC)
commit 29ad99c9b6103853e6d6bf42fa7bff335eb114a8
Author: Colin Walters <walters verbum org>
Date: Tue Aug 1 14:25:40 2017 -0400
console: Fix Coverity NULL deref warning
We need to handle our "empty to NULL canonicalization" before
doing the length.
Coverity CID: 1376570
glnx-console.c | 3 ++-
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]