Mercurial > pidgin.yaz
comparison libpurple/protocols/msn/slp.c @ 30496:ad6c8747e835
Don't crash if there's no Hashed-Nonce or Nonce.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 21 May 2010 04:22:33 +0000 |
parents | 4bcb8e537fc0 |
children | 3c4f821de25b |
comparison
equal
deleted
inserted
replaced
30495:4bcb8e537fc0 | 30496:ad6c8747e835 |
---|---|
289 *ntype = DC_NONCE_SHA1; | 289 *ntype = DC_NONCE_SHA1; |
290 } else { | 290 } else { |
291 guint32 n1, n5; | 291 guint32 n1, n5; |
292 guint16 n2, n3, n4, n6; | 292 guint16 n2, n3, n4, n6; |
293 nonce = get_token(content, "Nonce: {", "}\r\n"); | 293 nonce = get_token(content, "Nonce: {", "}\r\n"); |
294 *ntype = DC_NONCE_PLAIN; | 294 if (nonce |
295 if (sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx", | 295 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx", |
296 &n1, &n2, &n3, &n4, &n5, &n6) == 6) { | 296 &n1, &n2, &n3, &n4, &n5, &n6) == 6) { |
297 *ntype = DC_NONCE_PLAIN; | |
297 g_free(nonce); | 298 g_free(nonce); |
298 nonce = g_malloc(16); | 299 nonce = g_malloc(16); |
299 *(guint32 *)(nonce + 0) = GUINT32_TO_LE(n1); | 300 *(guint32 *)(nonce + 0) = GUINT32_TO_LE(n1); |
300 *(guint16 *)(nonce + 4) = GUINT16_TO_LE(n2); | 301 *(guint16 *)(nonce + 4) = GUINT16_TO_LE(n2); |
301 *(guint16 *)(nonce + 6) = GUINT16_TO_LE(n3); | 302 *(guint16 *)(nonce + 6) = GUINT16_TO_LE(n3); |