Mercurial > pidgin.yaz
changeset 14142:89d043d547cc
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 16 Aug 2006 06:58:59 +0000 |
parents | 5f656a0a82b7 |
children | 11394a70de37 |
files | src/protocols/yahoo/yahoo_packet.c |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);