Hi,

Hopefully I'll get the etiquette of this correct; let me know if not.

I found an situation which caused exchange2ical to crash: in a couple of places the value of the pointer attachmentFlags was NULL, but it was expected to be valid. I've stopped it from crashing by simply wrapping the two places it was used in if() testing.

NB: I'm not saying I've definitely fixed a bug; merely saying I've made my problem go away. I don't yet understand the code well enough to have a decent idea of the implications.

Tiny patch in unified diff against 0.9 attached but I expect it to work against SVN release too (can't test because of Samba-building fun).

If you'd like backtraces etc then give me a shout.

cheers
jack
diff -ru openchange-0.9-COCHRANE/libexchange2ical/exchange2ical.c openchange-0.9-COCHRANE.edited/libexchange2ical/exchange2ical.c
--- openchange-0.9-COCHRANE/libexchange2ical/exchange2ical.c	2009-12-23 22:54:27.000000000 +0000
+++ openchange-0.9-COCHRANE.edited/libexchange2ical/exchange2ical.c	2010-05-19 12:19:46.252727148 +0100
@@ -443,6 +443,7 @@
 					attachMethod	 = (uint32_t *) octool_get_propval(&aRow2, PR_ATTACH_METHOD);
 					attachmentHidden = (uint8_t *) octool_get_propval(&aRow2, PR_ATTACHMENT_HIDDEN);
 
+                    if(attachmentFlags && attachMethod && attachmentHidden) {
 					if((*attachmentFlags & 0x00000002) 
 						&& (*attachMethod == 0x00000005) 
 						&& (attachmentHidden && (*attachmentHidden))) {
@@ -580,6 +581,7 @@
 						} 							
 						mapi_object_release(&exception.obj_message);
 					}
+                    }
 					MAPIFreeBuffer(lpProps);
 				}
 			}
diff -ru openchange-0.9-COCHRANE/libexchange2ical/exchange2ical_property.c openchange-0.9-COCHRANE.edited/libexchange2ical/exchange2ical_property.c
--- openchange-0.9-COCHRANE/libexchange2ical/exchange2ical_property.c	2009-12-23 23:42:56.000000000 +0000
+++ openchange-0.9-COCHRANE.edited/libexchange2ical/exchange2ical_property.c	2010-05-19 12:15:58.875725091 +0100
@@ -153,6 +153,7 @@
 					attachMethod	 = octool_get_propval(&aRow2, PR_ATTACH_METHOD);
 					attachmentHidden = octool_get_propval(&aRow2, PR_ATTACHMENT_HIDDEN);
 
+                    if(attachmentFlags && attachMethod && attachmentHidden) {
 					if(!(*attachmentFlags & 0x00000007) 
 						&& (*attachMethod == 0x00000001) 
 						&& (!attachmentHidden || !(*attachmentHidden))) {
@@ -195,6 +196,7 @@
 						icalparameter_set_xname(param,"X-FILENAME");
 						icalproperty_add_parameter(prop,param);
 					}
+                    }
 					MAPIFreeBuffer(lpProps);
 				}
 			}
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to