[evolution-exchange/gnome-2-32] Can read out of bounds in exchange_folder_get_message_sync
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-exchange/gnome-2-32] Can read out of bounds in exchange_folder_get_message_sync
- Date: Mon, 8 Nov 2010 13:29:15 +0000 (UTC)
commit d13e74b52cac1e7485eebd297e6b470dc4bd1a98
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 8 14:29:00 2010 +0100
Can read out of bounds in exchange_folder_get_message_sync
camel/camel-exchange-folder.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-exchange-folder.c b/camel/camel-exchange-folder.c
index 25a5f1a..b350c92 100644
--- a/camel/camel-exchange-folder.c
+++ b/camel/camel-exchange-folder.c
@@ -507,6 +507,8 @@ exchange_folder_get_message (CamelFolder *folder,
if (!ba)
return NULL;
+ g_byte_array_append (ba, (guint8 *) "", 1);
+
while ((ba->len > 10 && g_str_has_prefix ((const gchar *)ba->data, "MAIL FROM:")) ||
(ba->len > 8 && g_str_has_prefix ((const gchar *)ba->data, "RCPT TO:")) ||
(ba->len > 2 && (ba->data[0] == '\n' || ba->data[1] == '\n'))) {
@@ -522,6 +524,9 @@ exchange_folder_get_message (CamelFolder *folder,
break;
}
+ if (ba->len > 0 && ba->data[ba->len - 1] == 0)
+ g_byte_array_remove_index (ba, ba->len - 1);
+
stream = camel_stream_mem_new_with_byte_array (ba);
crlffilter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]