[evolution-mapi] Bug #681069 - Crash under e_mapi_util_copy_binary_r()



commit d0f27651250a845f95346fad5d7c6ff1df6ddd6c
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 3 12:44:01 2012 +0200

    Bug #681069 - Crash under e_mapi_util_copy_binary_r()

 src/calendar/e-cal-backend-mapi.c      |   16 ++++++++--------
 src/libexchangemapi/e-mapi-cal-utils.c |   14 +++++++++++---
 src/libexchangemapi/e-mapi-cal-utils.h |    6 +++---
 src/libexchangemapi/e-mapi-utils.c     |   14 +++++++-------
 src/libexchangemapi/e-mapi-utils.h     |    4 ++--
 5 files changed, 31 insertions(+), 23 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index eba783b..6c51694 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -1508,8 +1508,8 @@ ecbm_capture_req_props (EMapiConnection *conn,
 	if (ui32)
 		cbdata->appt_seq = *ui32;
 
-	cbdata->cleanglobalid = e_mapi_util_copy_binary_r (e_mapi_util_find_array_propval (&object->properties, PidLidCleanGlobalObjectId));
-	cbdata->globalid = e_mapi_util_copy_binary_r (e_mapi_util_find_array_propval (&object->properties, PidLidGlobalObjectId));
+	cbdata->cleanglobalid = e_mapi_util_copy_sbinary_short (e_mapi_util_find_array_propval (&object->properties, PidLidCleanGlobalObjectId));
+	cbdata->globalid = e_mapi_util_copy_sbinary_short (e_mapi_util_find_array_propval (&object->properties, PidLidGlobalObjectId));
 
 	cbdata->username = g_strdup (e_mapi_util_find_array_propval (&object->properties, PidTagSentRepresentingName));
 	cbdata->useridtype = g_strdup (e_mapi_util_find_array_propval (&object->properties, PidTagSentRepresentingAddressType));
@@ -1551,7 +1551,7 @@ ecbm_build_global_id_restriction (EMapiConnection *conn,
 				  GError **perror)
 {
 	ECalComponent *comp = user_data;
-	struct Binary_r sb;
+	struct SBinary_short sb;
 	struct SPropValue sprop;
 	struct mapi_SRestriction *restriction;
 	gchar *propval;
@@ -1651,8 +1651,8 @@ free_server_data (struct cal_cbdata *cbdata)
 
 	#define do_free(_func, _val) _func (_val); _val = NULL
 
-	do_free (e_mapi_util_free_binary_r, cbdata->cleanglobalid);
-	do_free (e_mapi_util_free_binary_r, cbdata->globalid);
+	do_free (e_mapi_util_free_sbinary_short, cbdata->cleanglobalid);
+	do_free (e_mapi_util_free_sbinary_short, cbdata->globalid);
 	do_free (g_free, cbdata->username);
 	do_free (g_free, cbdata->useridtype);
 	do_free (g_free, cbdata->userid);
@@ -2160,7 +2160,7 @@ ecbm_send_objects (ECalBackend *backend, EDataCal *cal, GCancellable *cancellabl
 			mapi_id_t mid = 0;
 			const gchar *compuid;
 			gchar *propval;
-			struct Binary_r globalid = { 0 }, cleanglobalid = { 0 };
+			struct SBinary_short globalid = { 0 }, cleanglobalid = { 0 };
 			struct timeval *exception_repleace_time = NULL, ex_rep_time = { 0 };
 			struct FILETIME creation_time = { 0 };
 			struct icaltimetype ical_creation_time = { 0 };
@@ -2251,9 +2251,9 @@ ecbm_send_objects (ECalBackend *backend, EDataCal *cal, GCancellable *cancellabl
 			}
 
 			if (cbdata.globalid)
-				e_mapi_util_free_binary_r (cbdata.globalid);
+				e_mapi_util_free_sbinary_short (cbdata.globalid);
 			if (cbdata.cleanglobalid)
-				e_mapi_util_free_binary_r (cbdata.cleanglobalid);
+				e_mapi_util_free_sbinary_short (cbdata.cleanglobalid);
 			cbdata.globalid = &globalid;
 			cbdata.cleanglobalid = &cleanglobalid;
 
diff --git a/src/libexchangemapi/e-mapi-cal-utils.c b/src/libexchangemapi/e-mapi-cal-utils.c
index e756537..0198ecd 100644
--- a/src/libexchangemapi/e-mapi-cal-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-utils.c
@@ -216,7 +216,7 @@ static const uint8_t GID_START_SEQ[] = {
    creation_time is a value of PR_CREATION_TIME
 */
 void
-e_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const gchar *uid, const struct timeval *exception_replace_time, const struct FILETIME *creation_time, struct Binary_r *sb)
+e_mapi_cal_util_generate_globalobjectid (gboolean is_clean, const gchar *uid, const struct timeval *exception_replace_time, const struct FILETIME *creation_time, struct SBinary_short *sb)
 {
 	GByteArray *ba;
 	guint32 val32;
@@ -1922,11 +1922,19 @@ e_mapi_cal_utils_comp_to_object (EMapiConnection *conn,
 		set_value (PidLidAppointmentSequence, &flag32);
 
 		if (cbdata->cleanglobalid) {
-			set_value (PidLidCleanGlobalObjectId, cbdata->cleanglobalid);
+			struct Binary_r bin;
+			bin.cb = cbdata->cleanglobalid->cb;
+			bin.lpb = cbdata->cleanglobalid->lpb;
+
+			set_value (PidLidCleanGlobalObjectId, &bin);
 		}
 
 		if (cbdata->globalid) {
-			set_value (PidLidGlobalObjectId, cbdata->globalid);
+			struct Binary_r bin;
+			bin.cb = cbdata->globalid->cb;
+			bin.lpb = cbdata->globalid->lpb;
+
+			set_value (PidLidGlobalObjectId, &bin);
 		}
 
 		flag32 = cbdata->resp;
diff --git a/src/libexchangemapi/e-mapi-cal-utils.h b/src/libexchangemapi/e-mapi-cal-utils.h
index ae536cf..2c173fe 100644
--- a/src/libexchangemapi/e-mapi-cal-utils.h
+++ b/src/libexchangemapi/e-mapi-cal-utils.h
@@ -57,8 +57,8 @@ struct cal_cbdata {
 	MAPIMeetingOptions meeting_type;
 	uint32_t appt_id;
 	uint32_t appt_seq;
-	struct Binary_r *globalid;
-	struct Binary_r *cleanglobalid;
+	struct SBinary_short *globalid;
+	struct SBinary_short *cleanglobalid;
 
 	uint32_t msgflags;
 	OlResponseStatus resp;
@@ -78,7 +78,7 @@ void		e_mapi_cal_util_generate_globalobjectid		(gboolean is_clean,
 								 const gchar *uid,
 								 const struct timeval *exception_replace_time,
 								 const struct FILETIME *creation_time,
-								 struct Binary_r *sb);
+								 struct SBinary_short *sb);
 
 uint32_t	e_mapi_cal_util_get_new_appt_id			(EMapiConnection *conn,
 								 mapi_id_t fid);
diff --git a/src/libexchangemapi/e-mapi-utils.c b/src/libexchangemapi/e-mapi-utils.c
index 13b452e..9e5eace 100644
--- a/src/libexchangemapi/e-mapi-utils.c
+++ b/src/libexchangemapi/e-mapi-utils.c
@@ -1003,16 +1003,16 @@ e_mapi_utils_push_crc32 (uint32_t crc32, uint8_t *bytes, uint32_t n_bytes)
 	return crc32;
 }
 
-/* copies a Binary_r, which should be freed with e_mapi_util_free_binary_r() */
-struct Binary_r *
-e_mapi_util_copy_binary_r (const struct Binary_r *bin)
+/* copies an SBinary_short, which should be freed with e_mapi_util_free_sbinary_short() */
+struct SBinary_short *
+e_mapi_util_copy_sbinary_short (const struct SBinary_short *bin)
 {
-	struct Binary_r *res;
+	struct SBinary_short *res;
 
 	if (!bin || !bin->cb)
 		return NULL;
 
-	res = g_new0 (struct Binary_r, 1);
+	res = g_new0 (struct SBinary_short, 1);
 	res->cb = bin->cb;
 	res->lpb = g_new (uint8_t, res->cb);
 	memcpy (res->lpb, bin->lpb, res->cb);
@@ -1020,9 +1020,9 @@ e_mapi_util_copy_binary_r (const struct Binary_r *bin)
 	return res;
 }
 
-/* frees Binary_r previously allocated by e_mapi_util_copy_binary_r() */
+/* frees SBinary_short previously allocated by e_mapi_util_copy_sbinary_short() */
 void
-e_mapi_util_free_binary_r (struct Binary_r *bin)
+e_mapi_util_free_sbinary_short (struct SBinary_short *bin)
 {
 	if (!bin)
 		return;
diff --git a/src/libexchangemapi/e-mapi-utils.h b/src/libexchangemapi/e-mapi-utils.h
index 8f080eb..d376aaf 100644
--- a/src/libexchangemapi/e-mapi-utils.h
+++ b/src/libexchangemapi/e-mapi-utils.h
@@ -106,8 +106,8 @@ uint32_t	e_mapi_utils_push_crc32			(uint32_t crc32,
 							 uint32_t n_bytes);
 
 struct
-Binary_r *	e_mapi_util_copy_binary_r		(const struct Binary_r *bin);
-void		e_mapi_util_free_binary_r		(struct Binary_r *bin);
+SBinary_short *	e_mapi_util_copy_sbinary_short		(const struct SBinary_short *bin);
+void		e_mapi_util_free_sbinary_short		(struct SBinary_short *bin);
 
 time_t		e_mapi_util_filetime_to_time_t		(const struct FILETIME *filetime);
 void		e_mapi_util_time_t_to_filetime		(const time_t tt,



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