Adium

Changeset 24183

Show
Ignore:
Timestamp:
07/02/2008 10:07:27 PM (5 months ago)
Author:
evands
Message:

g_hash_table_insert() does not copy keys or values passed to it. We must pass it allocated memory (or string constants). Putting [[NSApp applicationVersion] UTF8String] in the hash table as the version's value meant that when version was later accessed, it was more likely than not going to access garbage. Garbage does not make for good version numbers... or for well-formed XML.

The result was that anytime over XMPP we were asked for jabber:iq:version (which some servers do and some clients do), we sent out invalid XML. Ouch!

Fixes #10324 and any other "XMPP won't stay connected" or "XMPP server says we sent invalid XML" tickets filed against 1.2.6 or 1.3b6.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Purple Service/adiumPurpleCore.m

    r24163 r24183  
    234234                ui_info = g_hash_table_new_full(g_str_hash, g_str_equal, 
    235235                                                                                g_free, g_free); 
    236                 g_hash_table_insert(ui_info, "name", "Adium"); 
    237                 g_hash_table_insert(ui_info, "version", [[NSApp applicationVersion] UTF8String]); 
    238                 g_hash_table_insert(ui_info, "website", "http://adiumx.com"); 
    239                 g_hash_table_insert(ui_info, "dev_website", "http://trac.adiumx.com"); 
     236                g_hash_table_insert(ui_info, g_strdup("name"), g_strdup("Adium")); 
     237                g_hash_table_insert(ui_info, g_strdup("version"), g_strdup([[NSApp applicationVersion] UTF8String])); 
     238                g_hash_table_insert(ui_info, g_strdup("website"), g_strdup("http://adiumx.com")); 
     239                g_hash_table_insert(ui_info, g_strdup("dev_website"), g_strdup("http://trac.adiumx.com")); 
    240240        } 
    241241