From: <the...@us...> - 2006-08-16 06:59:04
|
Revision: 16784 Author: thekingant Date: 2006-08-15 23:58:59 -0700 (Tue, 15 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16784&view=rev Log Message: ----------- Never allow Yahoo! to insert a NULL value into the outgoing packet hash. This fixes some random crashes when the packet gets sent, and yahoo_packet_length() is called, which eventually calls strlen(NULL), which crashes Modified Paths: -------------- trunk/src/protocols/yahoo/yahoo_packet.c Modified: trunk/src/protocols/yahoo/yahoo_packet.c =================================================================== --- trunk/src/protocols/yahoo/yahoo_packet.c 2006-08-16 06:31:59 UTC (rev 16783) +++ trunk/src/protocols/yahoo/yahoo_packet.c 2006-08-16 06:58:59 UTC (rev 16784) @@ -40,7 +40,11 @@ void yahoo_packet_hash_str(struct yahoo_packet *pkt, int key, const char *value) { - struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); + struct yahoo_pair *pair; + + g_return_if_fail(value != NULL); + + pair = g_new0(struct yahoo_pair, 1); pair->key = key; pair->value = g_strdup(value); pkt->hash = g_slist_prepend(pkt->hash, pair); @@ -48,8 +52,9 @@ void yahoo_packet_hash_int(struct yahoo_packet *pkt, int key, int value) { - struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); + struct yahoo_pair *pair; + pair = g_new0(struct yahoo_pair, 1); pair->key = key; pair->value = g_strdup_printf("%d", value); pkt->hash = g_slist_prepend(pkt->hash, pair); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |