From b2ff06fc12dd755002216d7e70b98c14d8b6bfed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 3 Oct 2013 19:10:22 +0200 Subject: [PATCH] cli: fix a possible crash when casting NULL using NM_CONNECTION (rh #1011942) https://bugzilla.redhat.com/show_bug.cgi?id=1011942 --- cli/src/connections.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/src/connections.c b/cli/src/connections.c index 5bb12724ff..fd06ca5547 100644 --- a/cli/src/connections.c +++ b/cli/src/connections.c @@ -5512,7 +5512,10 @@ property_edit_submenu (NmCli *nmc, char *cmd_property_arg; /* Connection is dirty? (not saved or differs from the saved) */ - dirty = !nm_connection_compare (connection, NM_CONNECTION (rem_con), NM_SETTING_COMPARE_FLAG_EXACT); + dirty = !nm_connection_compare (connection, + rem_con ? NM_CONNECTION (rem_con) : NULL, + NM_SETTING_COMPARE_FLAG_EXACT); + if (nmc->editor_status_line) editor_show_status_line (connection, dirty); @@ -5891,7 +5894,9 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t nm_connection_get_uuid (connection)); /* Connection is dirty? (not saved or differs from the saved) */ - dirty = !nm_connection_compare (connection, NM_CONNECTION (rem_con), NM_SETTING_COMPARE_FLAG_EXACT); + dirty = !nm_connection_compare (connection, + rem_con ? NM_CONNECTION (rem_con) : NULL, + NM_SETTING_COMPARE_FLAG_EXACT); if (nmc->editor_status_line) editor_show_status_line (connection, dirty);