Commit 841c2591 authored by Jiří Klimeš's avatar Jiří Klimeš Committed by Dan Williams
Browse files

libnm-util: make nm_connection_replace_settings_from_connection() safer



When 'connection' and 'new_connection' arguments are the same object make the
function no-op and simply return true. Otherwise 'connection's settings are
removed, making it invalid.
Signed-off-by: default avatarJiří Klimeš <jklimes@redhat.com>
parent f5507633
......@@ -506,6 +506,11 @@ nm_connection_replace_settings_from_connection (NMConnection *connection,
if (error)
g_return_val_if_fail (*error == NULL, FALSE);
/* When 'connection' and 'new_connection' are the same object simply return
* in order not to destroy 'connection' */
if (connection == new_connection)
return TRUE;
/* No need to validate permissions like nm_connection_replace_settings()
* since we're dealing with an NMConnection which has already done that.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment