diff options
author | Mark Stapp <mjs@voltanet.io> | 2020-01-06 22:00:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-06 22:00:35 +0100 |
commit | 5c3be0814fb190b007ff31efa85cca5e66e2daab (patch) | |
tree | a1ccfecc075d149d34c12ea97d0aadb8da7a1343 /lib | |
parent | Merge pull request #5626 from qlyoung/fix-zapi-pbr-foo (diff) | |
parent | lib: dont decode more nexthops than we can handle (diff) | |
download | frr-5c3be0814fb190b007ff31efa85cca5e66e2daab.tar.xz frr-5c3be0814fb190b007ff31efa85cca5e66e2daab.zip |
Merge pull request #5621 from qlyoung/fix-zclient-excess-nexthop-decode
lib: dont decode more nexthops than we can handle
Diffstat (limited to 'lib')
-rw-r--r-- | lib/zclient.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c index 6982d287a..fd1b181e5 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2679,6 +2679,17 @@ int zapi_labels_decode(struct stream *s, struct zapi_labels *zl) } 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++) { znh = &zl->nexthops[i]; |