diff options
| author | Santosh P K <sapk@vmware.com> | 2020-01-07 07:47:13 -0800 | 
|---|---|---|
| committer | Santosh P K <sapk@vmware.com> | 2020-01-07 07:47:13 -0800 | 
| commit | a3a850a17df1705211cc908ee69382d60bb4cdff (patch) | |
| tree | f0694a305f7a96023357361133aae5c969a7a702 /bgpd/bgp_label.c | |
| parent | edd8ece6033b2e68941bb063607659fe0b4f0be6 (diff) | |
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.c | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c index 489ac6ea9f..ff1ab1a37d 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;  		}  | 
