mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 19:19:59 +00:00
lib: dont decode more nexthops than we can handle
If someone provides us more nexthops than our configured multipath setting, drop the rest of them Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
b833cc1ff4
commit
b900b3c6a4
@ -2679,6 +2679,17 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
STREAM_GETW(s, zl->nexthop_num);
|
STREAM_GETW(s, zl->nexthop_num);
|
||||||
|
|
||||||
|
if (zl->nexthop_num > MULTIPATH_NUM) {
|
||||||
|
flog_warn(
|
||||||
|
EC_LIB_ZAPI_ENCODE,
|
||||||
|
"%s: Prefix %pFX has %d nexthops, but we can only use the first %d",
|
||||||
|
__func__, &zl->route.prefix, zl->nexthop_num,
|
||||||
|
MULTIPATH_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
zl->nexthop_num = MIN(MULTIPATH_NUM, zl->nexthop_num);
|
||||||
|
|
||||||
for (int i = 0; i < zl->nexthop_num; i++) {
|
for (int i = 0; i < zl->nexthop_num; i++) {
|
||||||
znh = &zl->nexthops[i];
|
znh = &zl->nexthops[i];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user