Adium

Changeset 24184

Show
Ignore:
Timestamp:
07/02/2008 10:08:17 PM (6 months ago)
Author:
evands
Message:

Merged [24183]:
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
  • branches/adium-1.2/Plugins/Purple Service/adiumPurpleCore.m

    r24161 r24184  
    211211                ui_info = g_hash_table_new_full(g_str_hash, g_str_equal, 
    212212                                                                                g_free, g_free); 
    213                 g_hash_table_insert(ui_info, "name", "Adium"); 
    214                 g_hash_table_insert(ui_info, "version", [[NSApp applicationVersion] UTF8String]); 
    215                 g_hash_table_insert(ui_info, "website", "http://adiumx.com"); 
    216                 g_hash_table_insert(ui_info, "dev_website", "http://trac.adiumx.com"); 
     213                g_hash_table_insert(ui_info, g_strdup("name"), g_strdup("Adium")); 
     214                g_hash_table_insert(ui_info, g_strdup("version"), g_strdup([[NSApp applicationVersion] UTF8String])); 
     215                g_hash_table_insert(ui_info, g_strdup("website"), g_strdup("http://adiumx.com")); 
     216                g_hash_table_insert(ui_info, g_strdup("dev_website"), g_strdup("http://trac.adiumx.com")); 
    217217        } 
    218218