evolution-data-server r9684 - in trunk: camel/providers/groupwise servers/groupwise



Author: abharath
Date: Fri Oct 17 08:06:15 2008
New Revision: 9684
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9684&view=rev

Log:
2008-10-03  Milan Crha  <mcrha redhat com>

       ** Part of fix for bug #547243

       * e-gw-item.c: (e_gw_item_new_from_soap_parameter):
       * e-gw-connection.c: (e_gw_connection_get_attachment),
       (e_gw_connection_get_attachment_base64):
       Check for correct values to prevent invalid reads.


Modified:
   trunk/camel/providers/groupwise/ChangeLog
   trunk/camel/providers/groupwise/camel-groupwise-folder.c
   trunk/servers/groupwise/ChangeLog
   trunk/servers/groupwise/e-gw-connection.c
   trunk/servers/groupwise/e-gw-item.c

Modified: trunk/camel/providers/groupwise/camel-groupwise-folder.c
==============================================================================
--- trunk/camel/providers/groupwise/camel-groupwise-folder.c	(original)
+++ trunk/camel/providers/groupwise/camel-groupwise-folder.c	Fri Oct 17 08:06:15 2008
@@ -1780,7 +1780,7 @@
 
 
 	msg = camel_mime_message_new ();
-	if (has_mime_822) {
+	if (has_mime_822 && body) {
 		temp_stream = camel_stream_mem_new_with_buffer (body, body_len);
 		if (camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg, temp_stream) == -1) {
 			camel_object_unref (msg);

Modified: trunk/servers/groupwise/e-gw-connection.c
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.c	(original)
+++ trunk/servers/groupwise/e-gw-connection.c	Fri Oct 17 08:06:15 2008
@@ -2726,10 +2726,13 @@
 		buffer = soup_soap_parameter_get_string_value (param) ;
 	}
 
-	if (buffer && buf_length) {
+	if (buffer && buf_length && atoi (buf_length) > 0) {
 		gsize len = atoi (buf_length) ;
 		*attachment = g_base64_decode (buffer,&len) ;
 		*attach_length = len ;
+	} else {
+		*attachment = NULL;
+		*attach_length = 0;
 	}
 
 	/* free memory */
@@ -2794,7 +2797,7 @@
 		buffer = soup_soap_parameter_get_string_value (param) ;
 	}
 
-	if (buffer && buf_length) {
+	if (buffer && buf_length && atoi (buf_length) > 0) {
 		int len = atoi (buf_length) ;
 		*attachment = g_strdup (buffer);
 		*attach_length = len;
@@ -2802,6 +2805,10 @@
 			*offset_r = atoi (o_return);
 		else 
 			*offset_r = 0;
+	} else {
+		*attachment = NULL;
+		*attach_length = 0;
+		*offset_r = 0;
 	}
 
 	/* free memory */

Modified: trunk/servers/groupwise/e-gw-item.c
==============================================================================
--- trunk/servers/groupwise/e-gw-item.c	(original)
+++ trunk/servers/groupwise/e-gw-item.c	Fri Oct 17 08:06:15 2008
@@ -1951,7 +1951,7 @@
 			msg = soup_soap_parameter_get_string_value (part);
 			length = soup_soap_parameter_get_property (part, "length");
 
-			if (msg && length) {
+			if (msg && length && atoi (length) > 0) {
 				len = atoi (length);
 				item->priv->message = g_base64_decode  (msg, &len);
 				if (!(item->priv->message)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]