diff options
| author | Renato Westphal <renato@openbsd.org> | 2017-11-06 15:08:07 -0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-06 15:08:07 -0200 |
| commit | 965a99f58a211ba5b5523df4d38eae55eba5459c (patch) | |
| tree | 695b08de1e1384b853c299ea23248b01a16b8d6a | |
| parent | fa74cda30a5bd77d1c42df9b6fcfcdf090543ea1 (diff) | |
| parent | d2b6417bd6f91cdc614c3bf983370c030f03642b (diff) | |
Merge pull request #1406 from donaldsharp/bgpd_ecommunity_crash
bgpd: Fix crash with ecommunity string
| -rw-r--r-- | bgpd/bgp_ecommunity.c | 8 | ||||
| -rw-r--r-- | bgpd/bgp_packet.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index bdcc12705c..e19f516505 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -702,8 +702,12 @@ char *ecommunity_ecom2str(struct ecommunity *ecom, int format, int filter) len = sprintf( str_buf + str_pnt, "EVPN:%02x:%02x:%02x:%02x:%02x:%02x", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); + (uint8_t)macaddr[0], + (uint8_t)macaddr[1], + (uint8_t)macaddr[2], + (uint8_t)macaddr[3], + (uint8_t)macaddr[4], + (uint8_t)macaddr[5]); } else if (*pnt == ECOMMUNITY_EVPN_SUBTYPE_MACMOBILITY) { u_int32_t seqnum; diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 28700dd241..b7f0114045 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -2012,6 +2012,7 @@ static int bgp_capability_msg_parse(struct peer *peer, u_char *pnt, /* Fetch structure to the byte stream. */ memcpy(&mpc, pnt + 3, sizeof(struct capability_mp_data)); + pnt += hdr->length + 3; /* We know MP Capability Code. */ if (hdr->code == CAPABILITY_CODE_MP) { @@ -2064,7 +2065,6 @@ static int bgp_capability_msg_parse(struct peer *peer, u_char *pnt, "%s unrecognized capability code: %d - ignored", peer->host, hdr->code); } - pnt += hdr->length + 3; } return 0; } |
