From: Axel Wagner Date: Tue, 3 May 2011 10:38:57 +0000 (+0200) Subject: Fix unaligned memory access on sparc (Thanks David Coppa) X-Git-Tag: 4.0.1~7^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3b19edf148b57c018220984e279689439673747a;p=i3%2Fi3 Fix unaligned memory access on sparc (Thanks David Coppa) --- diff --git a/i3bar/src/ipc.c b/i3bar/src/ipc.c index e7303bf8..cff3ed38 100644 --- a/i3bar/src/ipc.c +++ b/i3bar/src/ipc.c @@ -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 */