fix address assigment
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index f046801..d2f9eb8 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3515,7 +3515,7 @@
*(uint16_t *) (igmp_msg + IGMP_V3_CHECKSUM_OFFSET) = 0; /* for computing checksum */
*(uint16_t *) (igmp_msg + IGMP_V3_REPORT_NUMGROUPS_OFFSET) = htons(1); /* one group record */
*(uint8_t *) (group_record + IGMP_V3_GROUP_RECORD_TYPE_OFFSET) = record_type;
- *(struct in_addr *)(group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET) = grp_addr;
+ memcpy(group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET, &grp_addr, sizeof(struct in_addr));
/* Scan LINE sources */
sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET);
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index f892652..4be52d6 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -1649,7 +1649,8 @@
query_buf[0] = PIM_IGMP_MEMBERSHIP_QUERY;
query_buf[1] = max_resp_code;
*(uint16_t *)(query_buf + IGMP_V3_CHECKSUM_OFFSET) = 0; /* for computing checksum */
- *(struct in_addr *)(query_buf + 4) = group_addr;
+ memcpy(query_buf+4, &group_addr, sizeof(struct in_addr));
+
query_buf[8] = (s_flag << 3) | querier_robustness_variable;
query_buf[9] = qqic;
*(uint16_t *)(query_buf + IGMP_V3_NUMSOURCES_OFFSET) = htons(num_sources);
diff --git a/pimd/pim_msg.c b/pimd/pim_msg.c
index 7eb63e8..79ae33a 100644
--- a/pimd/pim_msg.c
+++ b/pimd/pim_msg.c
@@ -62,7 +62,7 @@
buf[0] = PIM_MSG_ADDRESS_FAMILY_IPV4; /* addr family */
buf[1] = '\0'; /* native encoding */
- *(struct in_addr *)(buf + 2) = addr;
+ memcpy(buf+2, &addr, sizeof(struct in_addr));
return buf + ENCODED_IPV4_UCAST_SIZE;
}
@@ -81,7 +81,7 @@
buf[1] = '\0'; /* native encoding */
buf[2] = '\0'; /* reserved */
buf[3] = 32; /* mask len */
- *(struct in_addr *)(buf + 4) = addr;
+ memcpy(buf+4, &addr, sizeof(struct in_addr));
return buf + ENCODED_IPV4_GROUP_SIZE;
}
@@ -100,7 +100,7 @@
buf[1] = '\0'; /* native encoding */
buf[2] = 4; /* reserved = 0 | S bit = 1 | W bit = 0 | R bit = 0 */
buf[3] = 32; /* mask len */
- *(struct in_addr *)(buf + 4) = addr;
+ memcpy(buf+4, &addr, sizeof(struct in_addr));
return buf + ENCODED_IPV4_SOURCE_SIZE;
}
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 4ce9a3d..962c2b8 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -148,7 +148,7 @@
++curr;
*(uint8_t *) curr = 0; /* ucast IPv4 native encoding type (RFC 4601: 4.9.1) */
++curr;
- *(struct in_addr *) curr = p->u.prefix4;
+ memcpy(curr, &p->u.prefix4, sizeof(struct in_addr));
curr += sizeof(struct in_addr);
option_len += ucast_ipv4_encoding_len;
@@ -404,7 +404,8 @@
}
p->family = AF_INET; /* notice: AF_INET != PIM_MSG_ADDRESS_FAMILY_IPV4 */
- p->u.prefix4 = *(const struct in_addr *) addr;
+ memcpy(&p->u.prefix4, addr, sizeof(struct in_addr));
+
addr += sizeof(struct in_addr);
break;
@@ -475,7 +476,7 @@
}
p->family = AF_INET; /* notice: AF_INET != PIM_MSG_ADDRESS_FAMILY_IPV4 */
- p->u.prefix4 = *(const struct in_addr *) addr;
+ memcpy(&p->u.prefix4, addr, sizeof(struct in_addr));
p->prefixlen = mask_len;
addr += sizeof(struct in_addr);
@@ -549,7 +550,7 @@
}
p->family = AF_INET; /* notice: AF_INET != PIM_MSG_ADDRESS_FAMILY_IPV4 */
- p->u.prefix4 = *(const struct in_addr *) addr;
+ memcpy(&p->u.prefix4, addr, sizeof(struct in_addr));
p->prefixlen = mask_len;
/*