summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_label.c
diff options
context:
space:
mode:
authorSantosh P K <sapk@vmware.com>2020-01-07 16:47:13 +0100
committerSantosh P K <sapk@vmware.com>2020-01-07 16:47:13 +0100
commita3a850a17df1705211cc908ee69382d60bb4cdff (patch)
treef0694a305f7a96023357361133aae5c969a7a702 /bgpd/bgp_label.c
parentMerge pull request #5638 from qlyoung/fix-bgp-cluster-list-null-memcmp (diff)
downloadfrr-a3a850a17df1705211cc908ee69382d60bb4cdff.tar.xz
frr-a3a850a17df1705211cc908ee69382d60bb4cdff.zip
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: Santosh P K <sapk@vmware.com>
Diffstat (limited to 'bgpd/bgp_label.c')
-rw-r--r--bgpd/bgp_label.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 489ac6ea9..ff1ab1a37 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -368,7 +368,8 @@ int bgp_nlri_parse_label(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, BGP_ADDPATH_ID_LEN);
+ addpath_id = ntohl(addpath_id);
pnt += BGP_ADDPATH_ID_LEN;
}