]> git.sur5r.net Git - i3/i3/commitdiff
Fix unaligned memory access on sparc (Thanks David Coppa)
authorAxel Wagner <mail@merovius.de>
Tue, 3 May 2011 10:38:57 +0000 (12:38 +0200)
committerAxel Wagner <mail@merovius.de>
Tue, 3 May 2011 10:39:10 +0000 (12:39 +0200)
i3bar/src/ipc.c

index e7303bf8f5402fef6bf519e504f57535eb2e3fcc..cff3ed389cbba0a9873e25a0b1234487409f005d 100644 (file)
@@ -181,9 +181,11 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
     }
 
     char *walk = header + strlen(I3_IPC_MAGIC);
-    uint32_t size = *((uint32_t*) walk);
+    uint32_t size;
+    memcpy(&size, (uint32_t*)walk, sizeof(uint32_t));
     walk += sizeof(uint32_t);
-    uint32_t type = *((uint32_t*) walk);
+    uint32_t type;
+    memcpy(&type, (uint32_t*)walk, sizeof(uint32_t));
 
     /* Now that we know, what to expect, we can start read()ing the rest
      * of the message */