From: Quentin Young Date: Tue, 7 Jan 2020 01:09:23 +0000 (-0500) Subject: bgpd: fix unaligned access to addpath id X-Git-Tag: frr-7.2.1~4^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8629ea6839dcaf79b85e606248bd7dbd85b3b509;p=matthieu%2Ffrr.git bgpd: fix unaligned access to addpath id uint8_t * cannot be cast to uint32_t * unless the pointed-to address is aligned according to uint32_t's alignment rules. And it usually is not. Signed-off-by: Quentin Young --- diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 2633fcb800..d7f7fb0112 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4468,7 +4468,8 @@ int bgp_nlri_parse_ip(struct peer *peer, struct attr *attr, if (pnt + BGP_ADDPATH_ID_LEN > lim) return BGP_NLRI_PARSE_ERROR_PACKET_OVERFLOW; - addpath_id = ntohl(*((uint32_t *)pnt)); + memcpy(&addpath_id, pnt, 4); + addpath_id = ntohl(addpath_id); pnt += BGP_ADDPATH_ID_LEN; }