[balsa/autocrypt: 10/11] Check for NULL message
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/autocrypt: 10/11] Check for NULL message
- Date: Tue, 15 Jan 2019 01:16:42 +0000 (UTC)
commit 5157f6431905f9d17b07debaa14d184e05eb70c2
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Fri Jan 11 09:51:19 2019 -0500
Check for NULL message
* libbalsa/imap/imap-commands.c (imap_mbox_sort_msgno_client):
check for NULL message and for a message with a NULL envelope,
to avoid dereferencing NULL pointers.
ChangeLog | 8 ++++++++
libbalsa/imap/imap-commands.c | 4 ++++
2 files changed, 12 insertions(+)
---
diff --git a/ChangeLog b/ChangeLog
index ea52b1176..3fc10471e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-01-11 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Check for NULL message
+
+ * libbalsa/imap/imap-commands.c (imap_mbox_sort_msgno_client):
+ check for NULL message and for a message with a NULL envelope,
+ to avoid dereferencing NULL pointers.
+
2018-01-10 Albrecht Dreß <albrecht dress arcor de>
Minor autocrypt fixes
diff --git a/libbalsa/imap/imap-commands.c b/libbalsa/imap/imap-commands.c
index 5d96d817d..19feef702 100644
--- a/libbalsa/imap/imap-commands.c
+++ b/libbalsa/imap/imap-commands.c
@@ -1868,6 +1868,10 @@ imap_mbox_sort_msgno_client(ImapMboxHandle *handle, ImapSortKey key,
sort_items = g_new(struct SortItem, cnt);
for(i=0; i<cnt; i++) {
sort_items[i].msg = imap_mbox_handle_get_msg(handle, msgno[i]);
+ if ((sort_items[i].msg == NULL) || (sort_items[i].msg->envelope == NULL)) {
+ g_free(sort_items);
+ return IMR_BAD;
+ }
sort_items[i].no = msgno[i];
}
switch(key) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]