RTPproxy: fix an unaligned access reported by UBSan

This commit is contained in:
Pascal Quantin 2023-11-03 12:49:51 +01:00
parent d1f64e9cbb
commit e3642264fa
1 changed files with 3 additions and 1 deletions

View File

@ -517,7 +517,9 @@ rtpproxy_add_notify_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *rtpproxy
/* Only port is supplied - take IPv4/IPv6 from ip.src/ipv6.src respectively */
expert_add_info(pinfo, rtpproxy_tree, &ei_rtpproxy_notify_no_ip);
if (pinfo->src.type == AT_IPv4) {
ti = proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, *(const guint32*)(pinfo->src.data));
guint32 addr;
memcpy(&addr, pinfo->src.data, 4);
ti = proto_tree_add_ipv4(rtpproxy_tree, hf_rtpproxy_notify_ipv4, tvb, begin, 0, addr);
} else if (pinfo->src.type == AT_IPv6) {
ti = proto_tree_add_ipv6(rtpproxy_tree, hf_rtpproxy_notify_ipv6, tvb, begin, 0, (const ws_in6_addr *)(pinfo->src.data));
}