From 0139ad37f723e3a587dcfbdbf33845815ad52025 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 1 Nov 2013 18:25:31 +0100 Subject: [PATCH] cli: fix potential crash in nmcli when using strcmp Error found by running Coverity https://bugzilla.redhat.com/show_bug.cgi?id=1025894 Signed-off-by: Thomas Haller --- cli/src/connections.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/connections.c b/cli/src/connections.c index 5ed43cb90f..b0c21daea8 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -461,7 +461,7 @@ find_connection (GSList *list, const char *filter_type, const char *filter_val) || ( (!filter_type || strcmp (filter_type, "uuid") == 0) && strcmp (filter_val, uuid) == 0) || ( (!filter_type || strcmp (filter_type, "path") == 0) - && (strcmp (filter_val, path) == 0 || (filter_type && g_strcmp0 (filter_val, path_num) == 0)))) + && (g_strcmp0 (filter_val, path) == 0 || (filter_type && g_strcmp0 (filter_val, path_num) == 0)))) return connection; iterator = g_slist_next (iterator); @@ -734,9 +734,9 @@ find_active_connection (const GPtrArray *active_cons, const GSList *cons, || ( (!filter_type || strcmp (filter_type, "uuid") == 0) && strcmp (filter_val, uuid) == 0) || ( (!filter_type || strcmp (filter_type, "path") == 0) - && (strcmp (filter_val, path) == 0 || (filter_type && g_strcmp0 (filter_val, path_num) == 0))) + && (g_strcmp0 (filter_val, path) == 0 || (filter_type && g_strcmp0 (filter_val, path_num) == 0))) || ( (!filter_type || strcmp (filter_type, "apath") == 0) - && (strcmp (filter_val, a_path) == 0 || (filter_type && g_strcmp0 (filter_val, a_path_num) == 0)))) + && (g_strcmp0 (filter_val, a_path) == 0 || (filter_type && g_strcmp0 (filter_val, a_path_num) == 0)))) return candidate; } return NULL;