# HG changeset patch # User Eric Warmenhoven # Date 1005863687 0 # Node ID 7f3f4aa114ad5a071d9712478f9039fc0cfe91dd # Parent ca32b587589f68f981691928cc42cfa61df784ea [gaim-migrate @ 2737] this seems... i don't know. committer: Tailor Script diff -r ca32b587589f -r 7f3f4aa114ad src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Thu Nov 15 22:26:13 2001 +0000 +++ b/src/protocols/yahoo/yahoo.c Thu Nov 15 22:34:47 2001 +0000 @@ -213,11 +213,11 @@ int pos = 0; while (pos + 1 < len) { - char key[64], *value; + char key[64], *value = NULL; + int accept; int x; struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1); - pkt->hash = g_slist_append(pkt->hash, pair); x = 0; while (pos + 1 < len) { @@ -228,19 +228,28 @@ key[x] = 0; pos += 2; pair->key = strtol(key, NULL, 10); + accept = x; /* if x is 0 there was no key, so don't accept it */ - value = g_malloc(len - pos + 1); + if (accept) + value = g_malloc(len - pos + 1); x = 0; while (pos + 1 < len) { if (data[pos] == 0xc0 && data[pos + 1] == 0x80) break; - value[x++] = data[pos++]; + if (accept) + value[x++] = data[pos++]; } - value[x] = 0; + if (accept) + value[x] = 0; pos += 2; - pair->value = g_strdup(value); - g_free(value); - debug_printf("Key: %d \tValue: %s\n", pair->key, pair->value); + if (accept) { + pair->value = g_strdup(value); + g_free(value); + pkt->hash = g_slist_append(pkt->hash, pair); + debug_printf("Key: %d \tValue: %s\n", pair->key, pair->value); + } else { + g_free(pair); + } } }