pidgin: 44bc6927: For processing mobile OIM's, fix a crash...

qulogic at pidgin.im qulogic at pidgin.im
Sun Dec 14 22:05:29 EST 2008


-----------------------------------------------------------------
Revision: 44bc6927617b36912dc84306fe8d80a6a9b942a3
Ancestor: c38894eea53702ed4c179c079dc63555c7c7a3b9
Author: qulogic at pidgin.im
Date: 2008-12-15T03:00:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/44bc6927617b36912dc84306fe8d80a6a9b942a3

Modified files:
        libpurple/protocols/msn/oim.c

ChangeLog: 

For processing mobile OIM's, fix a crash when searching through each part
of the message. There could be no content-type/body if it was unparseable.
Also, skip the first part which is "This is a multipart message... " text.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/oim.c	b7f2adb2d9bae3eea26fccc1aa2208062ad1b711
+++ libpurple/protocols/msn/oim.c	c7e072037e4188f57307c0b6e58a453845ba8592
@@ -630,13 +630,16 @@ msn_oim_report_to_user(MsnOimRecvData *r
 		                           msn_message_get_attr(message, "boundary"));
 		tokens = g_strsplit(message->body, boundary, 0);
 
-		for (part = tokens; *part != NULL; part++) {
+		/* tokens+1 to skip the "This is a multipart message..." text */
+		for (part = tokens+1; *part != NULL; part++) {
 			MsnMessage *multipart;
+			const char *type;
 			multipart = msn_message_new(MSN_MSG_UNKNOWN);
 			msn_message_parse_payload(multipart, *part, strlen(*part),
 			                          MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
 
-			if (!strcmp(msn_message_get_content_type(multipart), "text/plain")) {
+			type = msn_message_get_content_type(multipart);
+			if (type && !strcmp(type, "text/plain")) {
 				decode_msg = (char *)purple_base64_decode(multipart->body, &body_len);
 				msn_message_destroy(multipart);
 				break;


More information about the Commits mailing list