pidgin: 3d06dcec: So, elb informs me this is probably not ...

qulogic at pidgin.im qulogic at pidgin.im
Fri May 28 20:15:47 EDT 2010


-----------------------------------------------------------------
Revision: 3d06dcec459627c8d74d000f5ade3e6734a1508f
Ancestor: 3c21b2e016838fd091f44504a2642f7e090323e0
Author: qulogic at pidgin.im
Date: 2010-05-28T23:16:57
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3d06dcec459627c8d74d000f5ade3e6734a1508f

Modified files:
        libpurple/protocols/msn/slp.c

ChangeLog: 

So, elb informs me this is probably not safe on non-x86 architectures.
Swapping the types of these two should hopefully avoid a non-aligned write.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slp.c	b0a0e9d9da7f607dd4833c7e1a63a315f5d8118e
+++ libpurple/protocols/msn/slp.c	ba3469991932a7a862d9b0f4019a9fef5fb162e3
@@ -288,11 +288,11 @@ parse_dc_nonce(const char *content, MsnD
 	if (nonce) {
 		*ntype = DC_NONCE_SHA1;
 	} else {
-		guint32 n1, n5;
-		guint16 n2, n3, n4, n6;
+		guint32 n1, n6;
+		guint16 n2, n3, n4, n5;
 		nonce = get_token(content, "Nonce: {", "}\r\n");
 		if (nonce
-		 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%08x%04hx",
+		 && sscanf(nonce, "%08x-%04hx-%04hx-%04hx-%04hx%08x",
 		           &n1, &n2, &n3, &n4, &n5, &n6) == 6) {
 			*ntype = DC_NONCE_PLAIN;
 			g_free(nonce);
@@ -301,8 +301,8 @@ parse_dc_nonce(const char *content, MsnD
 			*(guint16 *)(nonce +  4) = GUINT16_TO_LE(n2);
 			*(guint16 *)(nonce +  6) = GUINT16_TO_LE(n3);
 			*(guint16 *)(nonce +  8) = GUINT16_TO_BE(n4);
-			*(guint32 *)(nonce + 10) = GUINT32_TO_BE(n5);
-			*(guint16 *)(nonce + 14) = GUINT16_TO_BE(n6);
+			*(guint16 *)(nonce + 10) = GUINT16_TO_BE(n5);
+			*(guint32 *)(nonce + 12) = GUINT32_TO_BE(n6);
 		} else {
 			/* Invalid nonce, so ignore request */
 			g_free(nonce);


More information about the Commits mailing list