[epiphany/mcatanzaro/password-fixes: 2/5] password-manager: Don't crash on unexpected input from secret service
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/password-fixes: 2/5] password-manager: Don't crash on unexpected input from secret service
- Date: Tue, 13 Nov 2018 23:10:00 +0000 (UTC)
commit d77d2d706b567026df1acb62bd7e891d55eda73a
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Tue Nov 13 15:47:01 2018 -0600
password-manager: Don't crash on unexpected input from secret service
If there are more passwords in the secret service than expected, that's
weird and we probably did something wrong, but this is still external
data and external data should never crash Epiphany.
lib/sync/ephy-password-manager.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index 250a416e1..35cc386e3 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -443,12 +443,14 @@ update_password_cb (GList *records,
EphyPasswordRecord *record;
/* We expect only one matching record here. */
- g_assert (g_list_length (records) == 1);
-
- record = EPHY_PASSWORD_RECORD (records->data);
- ephy_password_record_set_password (record, data->password);
- ephy_password_manager_store_record (data->manager, record);
- g_signal_emit_by_name (data->manager, "synchronizable-modified", record, FALSE);
+ if (g_list_length (records) == 1) {
+ record = EPHY_PASSWORD_RECORD (records->data);
+ ephy_password_record_set_password (record, data->password);
+ ephy_password_manager_store_record (data->manager, record);
+ g_signal_emit_by_name (data->manager, "synchronizable-modified", record, FALSE);
+ } else {
+ g_warn_if_reached ();
+ }
g_list_free_full (records, g_object_unref);
update_password_async_data_free (data);
@@ -661,11 +663,13 @@ forget_cb (GList *records,
EphyPasswordRecord *record;
/* We expect only one matching record here. */
- g_assert (g_list_length (records) == 1);
-
- record = EPHY_PASSWORD_RECORD (records->data);
- g_signal_emit_by_name (self, "synchronizable-deleted", record);
- ephy_password_manager_forget_record (self, record, NULL);
+ if (g_list_length (records) == 1) {
+ record = EPHY_PASSWORD_RECORD (records->data);
+ g_signal_emit_by_name (self, "synchronizable-deleted", record);
+ ephy_password_manager_forget_record (self, record, NULL);
+ } else {
+ g_warn_if_reached ();
+ }
g_list_free_full (records, g_object_unref);
}
@@ -782,9 +786,10 @@ replace_existing_cb (GList *records,
ManageRecordAsyncData *data = (ManageRecordAsyncData *)user_data;
/* We expect only one matching record here. */
- g_assert (g_list_length (records) == 1);
-
- ephy_password_manager_forget_record (data->manager, records->data, data->record);
+ if (g_list_length (records) == 1)
+ ephy_password_manager_forget_record (data->manager, records->data, data->record);
+ else
+ g_warn_if_reached ();
g_list_free_full (records, g_object_unref);
manage_record_async_data_free (data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]