changeset 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 11e748b759a2
files libpurple/protocols/msn/slp.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Fri May 21 04:07:02 2010 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri May 21 04:22:33 2010 +0000
@@ -291,9 +291,10 @@
 		guint32 n1, n5;
 		guint16 n2, n3, n4, n6;
 		nonce = get_token(content, "Nonce: {", "}\r\n");
-		*ntype = DC_NONCE_PLAIN;
-		if (sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
+		if (nonce
+		 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
 		           &n1, &n2, &n3, &n4, &n5, &n6) == 6) {
+			*ntype = DC_NONCE_PLAIN;
 			g_free(nonce);
 			nonce = g_malloc(16);
 			*(guint32 *)(nonce +  0) = GUINT32_TO_LE(n1);