--- a/libpurple/protocols/mxit/chunk.c Thu Apr 03 04:23:35 2014 +0200
+++ b/libpurple/protocols/mxit/chunk.c Thu Apr 03 04:33:49 2014 +0200
@@ -170,9 +170,13 @@
static int get_int16( const char* chunkdata, short* value )
- *value = ntohs( *( (const short*) chunkdata ) ); /* host byte-order */
+ memcpy(&value_v, chunkdata, sizeof(value_v)); - return sizeof( short );
+ *value = ntohs(value_v); /* host byte-order */ + return sizeof(value_v); /*------------------------------------------------------------------------
@@ -184,9 +188,13 @@
static int get_int32( const char* chunkdata, int* value )
- *value = ntohl( *( (const int*) chunkdata ) ); /* host byte-order */
+ memcpy(&value_v, chunkdata, sizeof(value_v));
+ *value = ntohl(value_v); /* host byte-order */ + return sizeof(value_v); --- a/libpurple/protocols/mxit/chunk.h Thu Apr 03 04:23:35 2014 +0200
+++ b/libpurple/protocols/mxit/chunk.h Thu Apr 03 04:33:49 2014 +0200
@@ -84,7 +84,8 @@
static inline guint32 chunk_length( gchar* chunkheader )
- guint32 length = *( (const guint32*) &chunkheader[1] );
+ memcpy(&length, &chunkheader[1], sizeof(guint32)); --- a/libpurple/protocols/mxit/protocol.c Thu Apr 03 04:23:35 2014 +0200
+++ b/libpurple/protocols/mxit/protocol.c Thu Apr 03 04:33:49 2014 +0200
@@ -2093,11 +2093,12 @@
static int get_chunk_len( const char* chunkdata )
- sizeptr = (int*) &chunkdata[1]; /* we skip the first byte (type field) */
- return ntohl( *sizeptr );
+ /* we skip the first byte (type field) */ + memcpy(&size_val, &chunkdata[1], sizeof(size_val)); + return ntohl(size_val);