# HG changeset patch # User Mark Doliner # Date 1155711539 0 # Node ID 89d043d547cc74093c98c9867bf228374f9bcb2e # Parent 5f656a0a82b73193df6e77c3cb2af0fc99daab4a [gaim-migrate @ 16784] 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 committer: Tailor Script diff -r 5f656a0a82b7 -r 89d043d547cc src/protocols/yahoo/yahoo_packet.c --- a/src/protocols/yahoo/yahoo_packet.c Wed Aug 16 06:31:59 2006 +0000 +++ b/src/protocols/yahoo/yahoo_packet.c Wed Aug 16 06:58:59 2006 +0000 @@ -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);