summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_clist.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-09-07 15:58:18 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-09-09 19:50:58 +0200
commit937652c6e43fc74ba969bbace475bdf929cdc5d0 (patch)
treef2cdea6d59fa9e2f20eafc512fe21203f6acdd6b /bgpd/bgp_clist.c
parentMerge pull request #1118 from opensourcerouting/attr-kill-master (diff)
downloadfrr-937652c6e43fc74ba969bbace475bdf929cdc5d0.tar.xz
frr-937652c6e43fc74ba969bbace475bdf929cdc5d0.zip
*: fix be32 reading / 24-bit left shift
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_clist.c')
-rw-r--r--bgpd/bgp_clist.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index b62a0a540..f3bae9535 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -25,6 +25,7 @@
#include "memory.h"
#include "queue.h"
#include "filter.h"
+#include "stream.h"
#include "bgpd/bgpd.h"
#include "bgpd/bgp_community.h"
@@ -465,20 +466,10 @@ static char *lcommunity_str_get(struct lcommunity *lcom, int i)
str = pnt = XMALLOC(MTYPE_LCOMMUNITY_STR, 48);
ptr = (u_char *)lcomval.val;
- globaladmin = (*ptr++ << 24);
- globaladmin |= (*ptr++ << 16);
- globaladmin |= (*ptr++ << 8);
- globaladmin |= (*ptr++);
-
- localdata1 = (*ptr++ << 24);
- localdata1 |= (*ptr++ << 16);
- localdata1 |= (*ptr++ << 8);
- localdata1 |= (*ptr++);
-
- localdata2 = (*ptr++ << 24);
- localdata2 |= (*ptr++ << 16);
- localdata2 |= (*ptr++ << 8);
- localdata2 |= (*ptr++);
+ ptr = ptr_get_be32(ptr, &globaladmin);
+ ptr = ptr_get_be32(ptr, &localdata1);
+ ptr = ptr_get_be32(ptr, &localdata2);
+ (void)ptr; /* consume value */
sprintf(pnt, "%u:%u:%u", globaladmin, localdata1, localdata2);
pnt += strlen(pnt);