]> git.sur5r.net Git - i3/i3/commitdiff
Fix unaligned memory access on sparc (Thanks David Coppa)
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 28 Apr 2011 19:47:14 +0000 (21:47 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 28 Apr 2011 19:47:58 +0000 (21:47 +0200)
src/ipc.c

index 3b4bb524b29e1b1f7e5df1673782250ff5140fd9..13bc4ffbc9926ca619e1c0c76ae6633eba11395d 100644 (file)
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -463,7 +463,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
                 n -= strlen(I3_IPC_MAGIC);
 
                 /* The next 32 bit after the magic are the message size */
-                uint32_t message_size = *((uint32_t*)message);
+                uint32_t message_size;
+                memcpy(&message_size, (uint32_t*)message, sizeof(uint32_t));
                 message += sizeof(uint32_t);
                 n -= sizeof(uint32_t);
 
@@ -473,7 +474,8 @@ static void ipc_receive_message(EV_P_ struct ev_io *w, int revents) {
                 }
 
                 /* The last 32 bits of the header are the message type */
-                uint32_t message_type = *((uint32_t*)message);
+                uint32_t message_type;
+                memcpy(&message_type, (uint32_t*)message, sizeof(uint32_t));
                 message += sizeof(uint32_t);
                 n -= sizeof(uint32_t);