pidgin: 4b8d2fa4: * Don't crash if status is NULL

markdoliner at pidgin.im markdoliner at pidgin.im
Mon Feb 8 20:55:40 EST 2010


-----------------------------------------------------------------
Revision: 4b8d2fa4d4c4d564b9ca1894b476f084390a9223
Ancestor: 82bea91d8b15d548f2eefa3fb33e7cb7252df802
Author: markdoliner at pidgin.im
Date: 2010-02-09T01:51:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4b8d2fa4d4c4d564b9ca1894b476f084390a9223

Modified files:
        libpurple/protocols/yahoo/libymsg.c

ChangeLog: 

* Don't crash if status is NULL
* Try to make the formatting of this code a little cleaner (to me, anyway)
* Print out the entire xml string instead of just pieces.  Avoids a
  potential NULL-printf (do we still care about these? I heard a rumor
  that newer windows glibc handled "%s", null), and provides more info

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c	7f6a0fd6f087d27001e9ad24ff84a5b33efdc2ae
+++ libpurple/protocols/yahoo/libymsg.c	0cb34dda1f82d720a2771ad4fd0600456903b25c
@@ -4259,16 +4259,20 @@ static void yahoo_get_sms_carrier_cb(Pur
 		validate_data_child = xmlnode_get_child(validate_data_root, "carrier");
 		carrier = xmlnode_get_data(validate_data_child);
 
-		purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier);
+		purple_debug_info("yahoo", "SMS validate data: %s\n", webdata);
 
-		if( strcmp(status, "Valid") == 0) {
-			g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
-			yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND);
+		if (status && g_str_equal(status, "Valid") == 0) {
+			g_hash_table_insert(yd->sms_carrier,
+					g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
+			yahoo_send_im(sms_cb_data->gc, sms_cb_data->who,
+					sms_cb_data->what, PURPLE_MESSAGE_SEND);
+		} else {
+			g_hash_table_insert(yd->sms_carrier,
+					g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
+			purple_conversation_write(conv, NULL,
+					_("Can't send SMS. Unknown mobile carrier."),
+					PURPLE_MESSAGE_SYSTEM, time(NULL));
 		}
-		else	{
-			g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
-			purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
-		}
 
 		xmlnode_free(validate_data_child);
 		xmlnode_free(validate_data_root);


More information about the Commits mailing list