[evolution-ews] Prevent crash under ews_backend_sync_created_folders()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Prevent crash under ews_backend_sync_created_folders()
- Date: Thu, 26 Oct 2017 08:01:03 +0000 (UTC)
commit 921ddabc2ccf5f6d5f28abb76b687a8fd757ce55
Author: Milan Crha <mcrha redhat com>
Date: Thu Oct 26 09:54:36 2017 +0200
Prevent crash under ews_backend_sync_created_folders()
When the passed in GSList of EEwsFolder objects contains a folder
which doesn't have the ID, or the folder object itself is otherwise
invalid, like when it could not be parsed from the server response
for some reason, then the returned EwsFolderId could be NULL, but it
was not checked for, which could lead to a NULL dereference and crash.
Such crashes had been reported downstream at:
https://retrace.fedoraproject.org/faf/reports/1823602/
src/collection/e-ews-backend.c | 4 +++-
src/server/e-ews-connection.c | 9 ++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index d6498f7..8eae4c8 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -213,6 +213,8 @@ ews_backend_new_child (EEwsBackend *backend,
fid = e_ews_folder_get_id (folder);
+ g_return_val_if_fail (fid != NULL, NULL);
+
collection_backend = E_COLLECTION_BACKEND (backend);
source = e_collection_backend_new_child (collection_backend, fid->id);
@@ -331,7 +333,7 @@ ews_backend_sync_created_folders (EEwsBackend *backend,
/* If we already know about this folder, skip it. */
fid = e_ews_folder_get_id (folder);
- if (fid->id == NULL)
+ if (!fid || !fid->id)
continue; /* not a valid ID anyway */
if (ews_backend_folders_contains (backend, fid->id))
continue;
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index a5f7371..2dd9da1 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -990,7 +990,8 @@ sync_xxx_response_cb (ESoapParameter *subparam,
EEwsFolder *folder;
folder = parser (subparam1);
- items_created = g_slist_append (items_created, folder);
+ if (folder)
+ items_created = g_slist_append (items_created, folder);
}
for (subparam1 = e_soap_parameter_get_first_child_by_name (node, "Update");
@@ -999,7 +1000,8 @@ sync_xxx_response_cb (ESoapParameter *subparam,
EEwsFolder *folder;
folder = parser (subparam1);
- items_updated = g_slist_append (items_updated, folder);
+ if (folder)
+ items_updated = g_slist_append (items_updated, folder);
}
/* Exchange 2007SP1 introduced <ReadFlagChange> which is basically identical
* to <Update>; no idea why they thought it was a good idea. */
@@ -1009,7 +1011,8 @@ sync_xxx_response_cb (ESoapParameter *subparam,
EEwsFolder *folder;
folder = parser (subparam1);
- items_updated = g_slist_append (items_updated, folder);
+ if (folder)
+ items_updated = g_slist_append (items_updated, folder);
}
for (subparam1 = e_soap_parameter_get_first_child_by_name (node, "Delete");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]