If we receive a malformed packet, we might end-up with a bad state.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
struct stream *s = BGP_INPUT(peer);
size_t end = stream_get_getp(s) + hdr->length;
- SET_FLAG(peer->cap, PEER_CAP_ADDPATH_RCV);
-
/* Verify length is a multiple of 4 */
if (hdr->length % CAPABILITY_CODE_ADDPATH_LEN) {
flog_warn(
return -1;
}
+ SET_FLAG(peer->cap, PEER_CAP_ADDPATH_RCV);
+
while (stream_get_getp(s) + CAPABILITY_CODE_ADDPATH_LEN <= end) {
afi_t afi;
safi_t safi;