Browse Source

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 năm trước cách đây
mục cha
commit
5dde373c90
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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;
 	uint32_t addr = 0;
 
 
+	memcpy (&addr, ip_addr->addr, sizeof (uint32_t));
+
 	if (ip_addr->family == AF_INET) {
 	if (ip_addr->family == AF_INET) {
-		addr = ntohl(*(int32_t*)ip_addr->addr);
+		addr = ntohl(addr);
 		if ((addr >> 28) != 0xE) {
 		if ((addr >> 28) != 0xE) {
 			return -1;
 			return -1;
 		}
 		}