瀏覽代碼

Fix problem where unaligned totemip address access would result in bus error on non-unaligned-safe architectures.

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
Steven Dake 15 年之前
父節點
當前提交
54a3a17274
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      exec/totemip.c

+ 3 - 1
exec/totemip.c

@@ -132,8 +132,10 @@ int32_t totemip_is_mcast(struct totem_ip_address *ip_addr)
 {
 	uint32_t addr = 0;
 
+	memcpy (&addr, ip_addr->addr, sizeof (uint32_t));
+
 	if (ip_addr->family == AF_INET) {
-		addr = ntohl(*(int32_t*)ip_addr->addr);
+		addr = ntohl(addr);
 		if ((addr >> 28) != 0xE) {
 			return -1;
 		}