d490f0
diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c
d490f0
--- openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c.covscan	2018-07-19 13:53:41.281450703 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_property.c	2018-07-19 13:53:41.285450703 +0200
d490f0
@@ -53,6 +53,7 @@ static void openchange_all_string_sub(ch
d490f0
 	}
d490f0
 }
d490f0
 
d490f0
+#if 0
d490f0
 struct RRULE_byday {
d490f0
 	uint16_t	DayOfWeek;
d490f0
 	const char	*DayName;
d490f0
@@ -68,6 +69,7 @@ static const struct RRULE_byday RRULE_by
d490f0
 	{ 0x0006,	"SA" },
d490f0
 	{ 0x0007,	NULL }
d490f0
 };
d490f0
+#endif
d490f0
 
d490f0
 static const char *get_filename(const char *filename)
d490f0
 {
d490f0
diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c
d490f0
--- openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c.covscan	2018-07-19 13:53:41.281450703 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libexchange2ical/exchange2ical_utils.c	2018-07-19 13:53:41.285450703 +0200
d490f0
@@ -232,7 +232,7 @@ uint32_t get_exchange_rdfDays_from_ical(
d490f0
 
d490f0
 struct icaltimetype get_icaltimetype_from_tm(struct tm *tm)
d490f0
 {
d490f0
-	struct icaltimetype tt;
d490f0
+	struct icaltimetype tt = icaltime_null_time ();
d490f0
 
d490f0
 	tt.year   = tm->tm_year+1900;
d490f0
 	tt.month  = tm->tm_mon+1;
d490f0
@@ -259,7 +259,7 @@ struct icaltimetype get_icaltimetype_fro
d490f0
 
d490f0
 struct icaltimetype get_icaldate_from_tm(struct tm *tm)
d490f0
 {
d490f0
-	struct icaltimetype tt;
d490f0
+	struct icaltimetype tt = icaltime_null_time ();
d490f0
 
d490f0
 	tt.year   = tm->tm_year+1900;
d490f0
 	tt.month  = tm->tm_mon+1;
d490f0
@@ -267,6 +267,7 @@ struct icaltimetype get_icaldate_from_tm
d490f0
 	tt.hour   = 0;
d490f0
 	tt.minute = 0;
d490f0
 	tt.second = 0;
d490f0
+	tt.zone   = NULL;
d490f0
 
d490f0
 	tt.is_date     = 1;
d490f0
 	tt.is_daylight = 0;
d490f0
@@ -292,7 +293,7 @@ struct tm *get_tm_from_FILETIME(const st
d490f0
 
d490f0
 struct icaltimetype get_icaltime_from_FILETIME(const struct FILETIME *ft)
d490f0
 {
d490f0
-	struct icaltimetype	tt;
d490f0
+	struct icaltimetype	tt = icaltime_null_time ();
d490f0
 	NTTIME			nttime;
d490f0
 	struct timeval		temp_timeval;
d490f0
 	struct tm		*tm;
d490f0
@@ -317,7 +318,7 @@ struct icaltimetype get_icaltime_from_FI
d490f0
 
d490f0
 struct icaltimetype get_icaltime_from_FILETIME_UTC(const struct FILETIME *ft)
d490f0
 {
d490f0
-	struct icaltimetype	tt;
d490f0
+	struct icaltimetype	tt = icaltime_null_time ();
d490f0
 	NTTIME			nttime;
d490f0
 	struct timeval		temp_timeval;
d490f0
 	struct tm		*tm;
d490f0
@@ -342,7 +343,7 @@ struct icaltimetype get_icaltime_from_FI
d490f0
 
d490f0
 struct icaltimetype get_icaldate_from_FILETIME(const struct FILETIME *ft)
d490f0
 {
d490f0
-	struct icaltimetype	tt;
d490f0
+	struct icaltimetype	tt = icaltime_null_time ();
d490f0
 	NTTIME			nttime;
d490f0
 	struct timeval		temp_timeval;
d490f0
 	struct tm		*tm;
d490f0
@@ -373,7 +374,7 @@ struct icaltimetype get_icaldate_from_FI
d490f0
 
d490f0
 struct icaltimetype get_icaldate_from_GlobalObjectId(struct GlobalObjectId *GlobalObjectId)
d490f0
 {
d490f0
-	struct icaltimetype	tt;
d490f0
+	struct icaltimetype	tt = icaltime_null_time ();
d490f0
 	tt.year   = GlobalObjectId->YH;
d490f0
 	tt.year   = tt.year <<8;
d490f0
 	tt.year   |= GlobalObjectId->YL;
d490f0
@@ -513,7 +514,10 @@ uint32_t get_minutes_from_icaltimetype(i
d490f0
 	time_t			time;
d490f0
 	NTTIME			nttime;
d490f0
 	struct timeval 		t;
d490f0
-	
d490f0
+
d490f0
+	if (icaltime_is_null_time(icaltime) || !icaltime_is_valid_time(icaltime))
d490f0
+		return 0;
d490f0
+
d490f0
 	tm.tm_year	= icaltime.year - 1900;
d490f0
 	tm.tm_mon 	= icaltime.month - 1;
d490f0
 	tm.tm_mday	= icaltime.day;
d490f0
diff -up openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c.covscan openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c
d490f0
--- openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libexchange2ical/ical2exchange_property.c	2018-07-19 13:53:41.286450703 +0200
d490f0
@@ -147,7 +147,6 @@ void ical2exchange_property_CATEGORIES(s
d490f0
 	struct StringArray_r *sArray;
d490f0
 	char **stringArray = NULL;
d490f0
 	char string[256];
d490f0
-	char *value;
d490f0
 	char *tok;
d490f0
 	icalproperty *categoriesProp;
d490f0
 	uint32_t i = 0;
d490f0
@@ -160,8 +159,10 @@ void ical2exchange_property_CATEGORIES(s
d490f0
 	categoriesProp = icalcomponent_get_first_property(ical2exchange->categoriesEvent, ICAL_CATEGORIES_PROPERTY);
d490f0
 	sArray->cValues = 0;
d490f0
 	while(categoriesProp){
d490f0
-	
d490f0
-		value = strdup(icalproperty_get_categories(categoriesProp));
d490f0
+		const char *categories = icalproperty_get_categories(categoriesProp);
d490f0
+		char *value;
d490f0
+
d490f0
+		value = strdup(categories ? categories : "");
d490f0
 		tok = strtok(value, ",");
d490f0
 		while(tok){
d490f0
 			if(!stringArray){
d490f0
@@ -185,6 +186,7 @@ void ical2exchange_property_CATEGORIES(s
d490f0
 		}
d490f0
 		categoriesProp = icalcomponent_get_next_property(ical2exchange->categoriesEvent, ICAL_CATEGORIES_PROPERTY);
d490f0
 
d490f0
+		free(value);
d490f0
 	}
d490f0
 	sArray->lppszA= (const char **) stringArray;
d490f0
 	
d490f0
@@ -519,6 +521,7 @@ void ical2exchange_property_RRULE_EXDATE
d490f0
 		
d490f0
 		ritr = icalrecur_iterator_new(irt,dtstart);
d490f0
 		next=icalrecur_iterator_next(ritr);
d490f0
+		last = icaltime_null_time();
d490f0
 		
d490f0
 		while (!icaltime_is_null_time(next)){
d490f0
 			last = next;
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/examples/foldertree.cpp	2018-07-19 13:53:41.286450703 +0200
d490f0
@@ -65,12 +65,12 @@ int main ()
d490f0
         	}
d490f0
 
d490f0
         }
d490f0
-        catch (libmapipp::mapi_exception e) // Catch any MAPI exceptions
d490f0
+        catch (libmapipp::mapi_exception &e) // Catch any MAPI exceptions
d490f0
         {
d490f0
                 std::cout << "MAPI Exception in main: " <<  e.what()
d490f0
 			  << std::endl;
d490f0
         }
d490f0
-        catch (std::runtime_error e) // Catch any other runtime exceptions
d490f0
+        catch (std::runtime_error &e) // Catch any other runtime exceptions
d490f0
         {
d490f0
                 std::cout << "std::runtime_error exception in main: "
d490f0
 			  << e.what() << std::endl;
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/examples/messages.cpp	2018-07-19 13:53:41.286450703 +0200
d490f0
@@ -61,12 +61,12 @@ int main ()
d490f0
 			}
d490f0
         	}
d490f0
         }
d490f0
-        catch (libmapipp::mapi_exception e) // Catch any MAPI exceptions
d490f0
+        catch (libmapipp::mapi_exception &e) // Catch any MAPI exceptions
d490f0
         {
d490f0
                 std::cout << "MAPI Exception in main: " <<  e.what()
d490f0
 			  << std::endl;
d490f0
         }
d490f0
-        catch (std::runtime_error e) // Catch any other runtime exceptions
d490f0
+        catch (std::runtime_error &e) // Catch any other runtime exceptions
d490f0
         {
d490f0
                 std::cout << "std::runtime_error exception in main: "
d490f0
 			  << e.what() << std::endl;
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/FXICS.c.covscan openchange-openchange-2.3-VULCAN/libmapi/FXICS.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/FXICS.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/FXICS.c	2018-07-19 13:53:41.286450703 +0200
d490f0
@@ -800,6 +800,7 @@ _PUBLIC_ enum MAPISTATUS FXGetBuffer(map
d490f0
 	if ((retval = mapi_object_get_logon_id(obj_source_context, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&request, 0, sizeof(struct FastTransferSourceGetBuffer_req));
d490f0
 	mem_ctx = talloc_named(session, 0, "FXGetBuffer");
d490f0
 	size = 0;
d490f0
 
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/idset.c.covscan openchange-openchange-2.3-VULCAN/libmapi/idset.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/idset.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/idset.c	2018-07-19 13:53:41.286450703 +0200
d490f0
@@ -383,6 +383,7 @@ _PUBLIC_ struct idset *IDSET_parse(TALLO
d490f0
 			total_bytes += 16;
d490f0
 		}
d490f0
 
d490f0
+		byte_count = 0;
d490f0
 		globset.length = buffer.length - 16;
d490f0
 		globset.data = (uint8_t *) buffer.data + 16;
d490f0
 		idset->ranges = GLOBSET_parse(idset, globset, &idset->range_count, &byte_count);
d490f0
@@ -1182,7 +1183,8 @@ _PUBLIC_ void RAWIDSET_push_eid(struct r
d490f0
 		}
d490f0
 		else {
d490f0
 			glob_idset = RAWIDSET_make(rawidset->mem_ctx, true, rawidset->single);
d490f0
-			last_glob_idset->next = glob_idset;
d490f0
+			if (last_glob_idset)
d490f0
+				last_glob_idset->next = glob_idset;
d490f0
 		}
d490f0
 		glob_idset->repl.id = eid_id;
d490f0
 	}
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/IMAPIProp.c	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -1122,6 +1122,7 @@ _PUBLIC_ enum MAPISTATUS QueryNamedPrope
d490f0
 		return retval;
d490f0
 
d490f0
 	/* Initialization */
d490f0
+	memset(&request, 0, sizeof(struct QueryNamedProperties_req));
d490f0
 	mem_ctx = talloc_named(session, 0, "QueryNamesFromIDs");
d490f0
 	size = 0;
d490f0
 
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/IMAPISupport.c	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -101,6 +101,7 @@ _PUBLIC_ enum MAPISTATUS Subscribe(mapi_
d490f0
 	if ((retval = mapi_object_get_logon_id(obj, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&request, 0, sizeof(struct RegisterNotification_req));
d490f0
 	mem_ctx = talloc_named(session, 0, "Subscribe");
d490f0
 
d490f0
 	/* Fill the Subscribe operation */
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/IMessage.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IMessage.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/IMessage.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/IMessage.c	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -499,6 +499,8 @@ _PUBLIC_ enum MAPISTATUS SetRecipientTyp
d490f0
 	enum MAPISTATUS		retval;
d490f0
 	struct SPropValue	lpProp;
d490f0
 
d490f0
+	memset(&lpProp, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	lpProp.ulPropTag = PR_RECIPIENT_TYPE;
d490f0
 	lpProp.value.l = RecipClass;
d490f0
 
d490f0
@@ -1648,6 +1650,7 @@ _PUBLIC_ enum MAPISTATUS OpenEmbeddedMes
d490f0
 	if ((retval = mapi_object_get_logon_id(obj_attach, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&lpProp, 0, sizeof(struct SPropValue));
d490f0
 	mem_ctx = talloc_named(session, 0, "OpenEmbeddedMessage");
d490f0
 
d490f0
 	/* Fill the OpenEmbeddedMessage request */
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/IStoreFolder.c	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -93,6 +93,7 @@ _PUBLIC_ enum MAPISTATUS OpenMessage(map
d490f0
 	if ((retval = mapi_object_get_logon_id(obj_store, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&lpProp, 0, sizeof(struct SPropValue));
d490f0
 	mem_ctx = talloc_named(session, 0, "OpenMessage");
d490f0
 
d490f0
 	/* Fill the OpenMessage operation */
d490f0
@@ -232,6 +233,7 @@ _PUBLIC_ enum MAPISTATUS ReloadCachedInf
d490f0
 	if ((retval = mapi_object_get_logon_id(obj_message, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&lpProp, 0, sizeof(struct SPropValue));
d490f0
 	mem_ctx = talloc_named(session, 0, "ReloadCachedInformation");
d490f0
 
d490f0
 	/* Fill the ReloadCachedInformation operation */
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi/IStream.c.covscan openchange-openchange-2.3-VULCAN/libmapi/IStream.c
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi/IStream.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi/IStream.c	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -183,6 +183,7 @@ _PUBLIC_ enum MAPISTATUS ReadStream(mapi
d490f0
 	if ((retval = mapi_object_get_logon_id(obj_stream, &logon_id)) != MAPI_E_SUCCESS)
d490f0
 		return retval;
d490f0
 
d490f0
+	memset(&request, 0, sizeof(struct ReadStream_req));
d490f0
 	mem_ctx = talloc_named(session, 0, "ReadStream");
d490f0
 
d490f0
 	*ByteRead = 0;
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/src/folder.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -57,7 +57,7 @@ folder::message_container_type folder::f
d490f0
 				message_container.push_back(message_shared_ptr(new message(m_session,
d490f0
 											   m_id,
d490f0
 											   row_set.aRow[i].lpProps[1].value.d)));
d490f0
-			} catch(mapi_exception e) {
d490f0
+			} catch(mapi_exception &e) {
d490f0
 				mapi_object_release(&contents_table);
d490f0
 				throw;
d490f0
 			}
d490f0
@@ -102,7 +102,7 @@ folder::hierarchy_container_type folder:
d490f0
 			try {
d490f0
 				hierarchy_container.push_back(folder_shared_ptr(new folder(*this,
d490f0
 							      row_set.aRow[i].lpProps[0].value.d)));
d490f0
-			} catch(mapi_exception e) {
d490f0
+			} catch(mapi_exception &e) {
d490f0
 				mapi_object_release(&hierarchy_table);
d490f0
 				throw;
d490f0
 			}
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/src/message.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -50,7 +50,7 @@ message::attachment_container_type messa
d490f0
 			try {
d490f0
 				attachment_container.push_back(attachment_shared_ptr(new attachment(*this, row_set.aRow[i].lpProps[0].value.l)));
d490f0
 			}
d490f0
-			catch(mapi_exception e) {
d490f0
+			catch(mapi_exception &e) {
d490f0
 				mapi_object_release(&attachment_table);
d490f0
 				throw;
d490f0
 			}
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/src/session.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -61,7 +61,7 @@ void session::login(const std::string& p
d490f0
 	if (m_profile_name == "") { // if profile is not set, try to get default profile
d490f0
 		try {
d490f0
 			m_profile_name = profile_database().get_default_profile_name();
d490f0
-		} catch(mapi_exception e) {
d490f0
+		} catch(mapi_exception &e) {
d490f0
 			uninitialize();
d490f0
 			throw;
d490f0
 		}
d490f0
@@ -74,7 +74,7 @@ void session::login(const std::string& p
d490f0
 
d490f0
 	try {
d490f0
 		m_message_store->open(m_session);
d490f0
-	} catch (mapi_exception e) {
d490f0
+	} catch (mapi_exception &e) {
d490f0
 		throw;
d490f0
 	}
d490f0
 }
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/tests/attach_test.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -84,11 +84,11 @@ int main()
d490f0
 
d490f0
 		print_folder_tree(top_folder, mapi_session);
d490f0
 	}
d490f0
-	catch (mapi_exception e) // Catch any mapi exceptions
d490f0
+	catch (mapi_exception &e) // Catch any mapi exceptions
d490f0
 	{
d490f0
 		cout << "MAPI Exception @ main: " <<  e.what() << endl;
d490f0
 	}
d490f0
-	catch (std::runtime_error e) // Catch runtime exceptions
d490f0
+	catch (std::runtime_error &e) // Catch runtime exceptions
d490f0
 	{
d490f0
 		cout << "std::runtime_error exception @ main: " << e.what() << endl;
d490f0
 	}
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/tests/exception_test.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -12,7 +12,7 @@ int main()
d490f0
 	try {
d490f0
 		dotest();
d490f0
 	}
d490f0
-	catch (libmapipp::mapi_exception e) {
d490f0
+	catch (libmapipp::mapi_exception &e) {
d490f0
 		std::cout << e.what() << std::endl;
d490f0
 	}
d490f0
 	
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/tests/profile_test.cpp	2018-07-19 13:53:41.287450703 +0200
d490f0
@@ -27,15 +27,18 @@
d490f0
 #define PROFILEDB_NAME_TEMPLATE "/tmp/mapidbXXXXXX"
d490f0
 int main ()
d490f0
 {
d490f0
+	char *tmpname = NULL, *tmpname2 = NULL;
d490f0
+
d490f0
 	try {
d490f0
 		libmapipp::profile_database db;
d490f0
 
d490f0
 		std::cout << "default profile name: " << db.get_default_profile_name() << std::endl;
d490f0
 
d490f0
 		{
d490f0
-			char *tmpname = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
d490f0
-			strncpy(tmpname, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
d490f0
-			int ret = mkstemp(tmpname);
d490f0
+			int ret;
d490f0
+
d490f0
+			tmpname = strdup(PROFILEDB_NAME_TEMPLATE);
d490f0
+			ret = mkstemp(tmpname);
d490f0
 			if (ret < 0) {
d490f0
 				std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
d490f0
 			}
d490f0
@@ -45,12 +48,15 @@ int main ()
d490f0
 				std::cout << "failed to create a temporary profile store" << std::endl;
d490f0
 			}
d490f0
 			unlink(tmpname);
d490f0
+			free(tmpname);
d490f0
+			tmpname = NULL;
d490f0
 		}
d490f0
 		
d490f0
 		{
d490f0
-			char *tmpname2 = (char*) calloc(sizeof(PROFILEDB_NAME_TEMPLATE) + 1, sizeof(char));
d490f0
-			strncpy(tmpname2, PROFILEDB_NAME_TEMPLATE, sizeof(PROFILEDB_NAME_TEMPLATE));
d490f0
-			int ret = mkstemp(tmpname2);
d490f0
+			int ret;
d490f0
+
d490f0
+			tmpname2 = strdup(PROFILEDB_NAME_TEMPLATE);
d490f0
+			ret = mkstemp(tmpname2);
d490f0
 			if (ret < 0) {
d490f0
 				std::cout << "failed to create temporary file: " << strerror(errno) << std::endl;
d490f0
 			}
d490f0
@@ -60,19 +66,33 @@ int main ()
d490f0
 				std::cout << "failed to create a temporary profile store with std::string" << std::endl;
d490f0
 			}
d490f0
 			unlink(tmpname2);
d490f0
+			free(tmpname2);
d490f0
+			tmpname2 = NULL;
d490f0
 		}
d490f0
 
d490f0
 		std::cout << "finished profile and profile database tests" << std::endl;
d490f0
 	}
d490f0
-	catch (libmapipp::mapi_exception e) // Catch any mapi exceptions
d490f0
+	catch (libmapipp::mapi_exception &e) // Catch any mapi exceptions
d490f0
 	{
d490f0
 		std::cout << "MAPI Exception @ main: " <<  e.what() << std::endl;
d490f0
 	}
d490f0
-	catch (std::runtime_error e) // Catch runtime exceptions
d490f0
+	catch (std::runtime_error &e) // Catch runtime exceptions
d490f0
 	{
d490f0
 		std::cout << "std::runtime_error exception @ main: " << e.what() << std::endl;
d490f0
 
d490f0
 	}
d490f0
 
d490f0
+	if (tmpname) {
d490f0
+		unlink(tmpname);
d490f0
+		free(tmpname);
d490f0
+		tmpname = NULL;
d490f0
+	}
d490f0
+
d490f0
+	if (tmpname2) {
d490f0
+		unlink(tmpname2);
d490f0
+		free(tmpname2);
d490f0
+		tmpname2 = NULL;
d490f0
+	}
d490f0
+
d490f0
 	return 0;
d490f0
 }
d490f0
diff -up openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp.covscan openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp
d490f0
--- openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libmapi++/tests/test.cpp	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -126,11 +126,11 @@ int main ()
d490f0
 
d490f0
 		cout << "finished session" << endl;
d490f0
 	}
d490f0
-	catch (mapi_exception e) // Catch any mapi exceptions
d490f0
+	catch (mapi_exception &e) // Catch any mapi exceptions
d490f0
 	{
d490f0
 		cout << "MAPI Exception @ main: " <<  e.what() << endl;
d490f0
 	}
d490f0
-	catch (std::runtime_error e) // Catch runtime exceptions
d490f0
+	catch (std::runtime_error &e) // Catch runtime exceptions
d490f0
 	{
d490f0
 		cout << "std::runtime_error exception @ main: " << e.what() << endl;
d490f0
 
d490f0
diff -up openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c.covscan openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c
d490f0
--- openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libocpf/ocpf_api.c	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -316,6 +316,8 @@ int ocpf_propvalue(struct ocpf_context *
d490f0
 	if (!ocpf || !ocpf->mem_ctx) return OCPF_ERROR;
d490f0
 	if (!ctx) return OCPF_ERROR;
d490f0
 
d490f0
+	memset(&lpProps, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	switch (scope) {
d490f0
 	case kw_PROPERTY:
d490f0
 		/* Sanity check: do not insert the same property twice */
d490f0
diff -up openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c.covscan openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c
d490f0
--- openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/libocpf/ocpf_public.c	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -537,6 +537,8 @@ static bool set_external_recipients(TALL
d490f0
 	uint32_t		last;
d490f0
 	struct SPropValue	SPropValue;
d490f0
 
d490f0
+	memset(&SPropValue, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 2);
d490f0
 	last = SRowSet->cRows;
d490f0
 	SRowSet->aRow[last].cValues = 0;
d490f0
@@ -626,6 +628,8 @@ _PUBLIC_ enum MAPISTATUS ocpf_set_Recipi
d490f0
 
d490f0
 	MAPI_RETVAL_IF(!ctx->recipients->cRows, MAPI_E_NOT_FOUND, NULL);
d490f0
 
d490f0
+	memset(&SPropValue, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	SPropTagArray = set_SPropTagArray(mem_ctx, 0x8,
d490f0
 					  PidTagObjectType,
d490f0
 					  PidTagDisplayName,
d490f0
diff -up openchange-openchange-2.3-VULCAN/ndr_mapi.c.covscan openchange-openchange-2.3-VULCAN/ndr_mapi.c
d490f0
--- openchange-openchange-2.3-VULCAN/ndr_mapi.c.covscan	2018-07-19 13:53:41.276450703 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/ndr_mapi.c	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -1310,8 +1310,11 @@ _PUBLIC_ enum ndr_err_code ndr_pull_EcDo
d490f0
 		NDR_PULL_ALLOC(ndr, r->out.pulTimeStamp);
d490f0
 		*r->out.pulTimeStamp = *r->in.pulTimeStamp;
d490f0
 		NDR_PULL_ALLOC(ndr, r->out.pcbAuxOut);
d490f0
-		*r->out.pcbAuxOut = *r->in.pcbAuxOut;
d490f0
-	}		
d490f0
+		if (r->in.pcbAuxOut)
d490f0
+			*r->out.pcbAuxOut = *r->in.pcbAuxOut;
d490f0
+		else
d490f0
+			*r->out.pcbAuxOut = 0;
d490f0
+	}
d490f0
 
d490f0
 	if (flags & NDR_OUT) {
d490f0
 		if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
d490f0
diff -up openchange-openchange-2.3-VULCAN/script/makepropslist.py.covscan openchange-openchange-2.3-VULCAN/script/makepropslist.py
d490f0
--- openchange-openchange-2.3-VULCAN/script/makepropslist.py.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/script/makepropslist.py	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -992,7 +992,7 @@ def check_duplicate_alternative_names():
d490f0
 				if previous_alternative_names.has_key(altname):
d490f0
 					print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates name in section", previous_alternative_names[altname]
d490f0
 				if previous_canonical_names.has_key(altname):
d490f0
-					print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates canonical name in section", previous_alternative_names[altname]
d490f0
+					print "\tIn section", entry["OXPROPS_Sect"], ", alternative name:", altname, "duplicates canonical name in section", previous_canonical_names[altname]
d490f0
 				previous_alternative_names[altname] = (entry["OXPROPS_Sect"])
d490f0
 
d490f0
 def check_duplicate_propids():
d490f0
diff -up openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c.covscan openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c
d490f0
--- openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c.covscan	2015-05-16 17:22:04.000000000 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/testprogs/test_asyncnotif.c	2018-07-19 13:53:41.288450703 +0200
d490f0
@@ -109,12 +109,16 @@ static int callback(uint16_t Notificatio
d490f0
 		break;
d490f0
 	case fnevMbit|fnevObjectDeleted:
d490f0
 		OC_DEBUG(0, "[+] Message deleted");
d490f0
+		break;
d490f0
 	case fnevMbit|fnevObjectModified:
d490f0
 		OC_DEBUG(0, "[+] Message modified");
d490f0
+		break;
d490f0
 	case fnevMbit|fnevObjectMoved:
d490f0
 		OC_DEBUG(0, "[+] Message moved");
d490f0
+		break;
d490f0
 	case fnevMbit|fnevObjectCopied:
d490f0
 		OC_DEBUG(0, "[+] Message copied");
d490f0
+		break;
d490f0
 	case fnevMbit|fnevTableModified:
d490f0
 		ctable = (struct ContentsTableChange *) NotificationData;
d490f0
 		switch (ctable->TableEvent) {
d490f0
@@ -143,6 +147,7 @@ static int callback(uint16_t Notificatio
d490f0
 		break;
d490f0
 	case fnevMbit|fnevSbit|fnevObjectModified:
d490f0
 		OC_DEBUG(0, "[+] A property on a message in a search folder has changed");
d490f0
+		break;
d490f0
 	case fnevMbit|fnevSbit|fnevTableModified:
d490f0
 		stable = (struct ContentsTableChange *) NotificationData;
d490f0
 		switch (stable->TableEvent) {
d490f0
@@ -250,6 +255,7 @@ int main(int argc, const char *argv[])
d490f0
 
d490f0
 	retval = MAPIInitialize(&mapi_ctx, opt_profdb);
d490f0
 	if (retval != MAPI_E_SUCCESS) {
d490f0
+		talloc_free(mem_ctx);
d490f0
 		mapi_errstr("MAPIInitialize", retval);
d490f0
 		exit (1);
d490f0
 	}
d490f0
@@ -261,6 +267,10 @@ int main(int argc, const char *argv[])
d490f0
 		SetMAPIDebugLevel(mapi_ctx, atoi(opt_debug));
d490f0
 	}
d490f0
 
d490f0
+	mapi_object_init(&obj_store);
d490f0
+	mapi_object_init(&obj_inbox);
d490f0
+	mapi_object_init(&obj_contentstable);
d490f0
+
d490f0
 	/* if no profile is supplied use the default one */
d490f0
 	if (!opt_profname) {
d490f0
 		retval = GetDefaultProfile(mapi_ctx, &opt_profname);
d490f0
@@ -280,7 +290,6 @@ int main(int argc, const char *argv[])
d490f0
 	}
d490f0
 
d490f0
 	/* Open the default message store */
d490f0
-	mapi_object_init(&obj_store);
d490f0
 
d490f0
 	retval = OpenMsgStore(session, &obj_store);
d490f0
 	if (retval != MAPI_E_SUCCESS) {
d490f0
@@ -292,11 +301,9 @@ int main(int argc, const char *argv[])
d490f0
 	retval = GetReceiveFolder(&obj_store, &fid, NULL);
d490f0
 	MAPI_RETVAL_IF(retval, retval, mem_ctx);
d490f0
 
d490f0
-	mapi_object_init(&obj_inbox);
d490f0
 	retval = OpenFolder(&obj_store, fid, &obj_inbox);
d490f0
 	MAPI_RETVAL_IF(retval, retval, mem_ctx);
d490f0
 
d490f0
-	mapi_object_init(&obj_contentstable);
d490f0
 	retval = GetContentsTable(&obj_inbox, &obj_contentstable, 0, &count);
d490f0
 	printf("mailbox contains %i messages\n", count);
d490f0
 
d490f0
diff -up openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.covscan openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c
d490f0
--- openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c.covscan	2018-07-19 13:53:41.276450703 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/utils/mapipropsdump.c	2018-07-19 13:53:41.289450703 +0200
d490f0
@@ -79,21 +79,21 @@
d490f0
  */
d490f0
 
d490f0
 
d490f0
-static const const struct ndr_interface_table *load_exchange_emsmdb_dso(const char *plugin)
d490f0
+static const struct ndr_interface_table *load_exchange_emsmdb_dso(const char *plugin, void **phandle)
d490f0
 {
d490f0
 	const struct ndr_interface_table	*p;
d490f0
-	void					*handle;
d490f0
 
d490f0
-	handle = dlopen(plugin, RTLD_NOW);
d490f0
-	if (handle == NULL) {
d490f0
+	*phandle = dlopen(plugin, RTLD_NOW);
d490f0
+	if (*phandle == NULL) {
d490f0
 		printf("%s: Unable to open: %s\n", plugin, dlerror());
d490f0
 		return NULL;
d490f0
 	}
d490f0
 
d490f0
-	p = (const struct ndr_interface_table *) dlsym(handle, "ndr_table_exchange_emsmdb");
d490f0
+	p = (const struct ndr_interface_table *) dlsym(*phandle, "ndr_table_exchange_emsmdb");
d490f0
 	if (!p) {
d490f0
 		OC_DEBUG(0, "%s: Unable to find DCE/RPC interface table for 'ndr_table_exchange_emsmdb': %s", plugin, dlerror());
d490f0
-		dlclose(handle);
d490f0
+		dlclose(*phandle);
d490f0
+		*phandle = NULL;
d490f0
 		return NULL;
d490f0
 	}
d490f0
 
d490f0
@@ -409,6 +409,7 @@ int main(int argc, const char *argv[])
d490f0
 	struct SPropTagArray			*s;
d490f0
 	const char				*opt_reqfile = NULL;
d490f0
 	const char				*opt_replfile = NULL;
d490f0
+	void					*plhandle = NULL;
d490f0
 	poptContext				pc;
d490f0
 	int					opt;
d490f0
 	int					index = -1;
d490f0
@@ -442,7 +443,7 @@ int main(int argc, const char *argv[])
d490f0
 		exit (1);
d490f0
 	}
d490f0
 
d490f0
-	p = load_exchange_emsmdb_dso(PLUGIN);
d490f0
+	p = load_exchange_emsmdb_dso(PLUGIN, &plhandle);
d490f0
 	if (!p) {
d490f0
 		exit (1);
d490f0
 	}
d490f0
@@ -454,6 +455,7 @@ int main(int argc, const char *argv[])
d490f0
 	s = process_request(mem_ctx, f, opt_reqfile, &opnum, &index);
d490f0
 	if (!s) {
d490f0
 		talloc_free(mem_ctx);
d490f0
+		dlclose(plhandle);
d490f0
 		exit (1);
d490f0
 	}
d490f0
 
d490f0
@@ -461,9 +463,12 @@ int main(int argc, const char *argv[])
d490f0
 	ret = process_response(mem_ctx, f, opt_replfile, s, opnum, index);
d490f0
 	if (ret == -1) {
d490f0
 		talloc_free(mem_ctx);
d490f0
+		dlclose(plhandle);
d490f0
 		exit (1);
d490f0
 	}
d490f0
 
d490f0
 	talloc_free(mem_ctx);
d490f0
+	dlclose(plhandle);
d490f0
+
d490f0
 	return (0);
d490f0
 }
d490f0
diff -up openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.covscan openchange-openchange-2.3-VULCAN/utils/openchangeclient.c
d490f0
--- openchange-openchange-2.3-VULCAN/utils/openchangeclient.c.covscan	2018-07-19 13:53:41.277450703 +0200
d490f0
+++ openchange-openchange-2.3-VULCAN/utils/openchangeclient.c	2018-07-19 13:53:41.289450703 +0200
d490f0
@@ -629,6 +629,8 @@ static bool set_external_recipients(TALL
d490f0
 	uint32_t		last;
d490f0
 	struct SPropValue	SPropValue;
d490f0
 
d490f0
+	memset(&SPropValue, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 1);
d490f0
 	last = SRowSet->cRows;
d490f0
 	SRowSet->aRow[last].cValues = 0;
d490f0
@@ -821,6 +823,8 @@ static enum MAPISTATUS openchangeclient_
d490f0
 	mapi_object_init(&obj_outbox);
d490f0
 	mapi_object_init(&obj_message);
d490f0
 
d490f0
+	memset(&SPropValue, 0, sizeof(struct SPropValue));
d490f0
+
d490f0
 	if (oclient->pf == true) {
d490f0
 		retval = openchangeclient_getpfdir(mem_ctx, obj_store, &obj_outbox, oclient->folder);
d490f0
 		if (retval != MAPI_E_SUCCESS) return retval;