diff options
author | Donald Sharp <donaldsharp72@gmail.com> | 2022-07-18 15:20:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 15:20:11 +0200 |
commit | 5f5b29862f4cd82c035badb7aefc55e08c38910b (patch) | |
tree | 4c5ac8a41871aecbd3fd3a97d5dd09bd28759b25 /zebra | |
parent | Merge pull request #11631 from opensourcerouting/fix/crash_for_checking_threa... (diff) | |
parent | zebra: Avoid buffer overflow using netlink_parse_rtattr_nested() (diff) | |
download | frr-5f5b29862f4cd82c035badb7aefc55e08c38910b.tar.xz frr-5f5b29862f4cd82c035badb7aefc55e08c38910b.zip |
Merge pull request #11626 from opensourcerouting/fix/avoid_buffer_overflow
zebra: Avoid buffer overflow using netlink_parse_rtattr_nested()
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/rt_netlink.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 1d9b59cf7..0eab1fa85 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -437,10 +437,10 @@ static enum seg6local_action_t parse_encap_seg6local(struct rtattr *tb, struct seg6local_context *ctx) { - struct rtattr *tb_encap[256] = {}; + struct rtattr *tb_encap[SEG6_LOCAL_MAX + 1] = {}; enum seg6local_action_t act = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC; - netlink_parse_rtattr_nested(tb_encap, 256, tb); + netlink_parse_rtattr_nested(tb_encap, SEG6_LOCAL_MAX, tb); if (tb_encap[SEG6_LOCAL_ACTION]) act = *(uint32_t *)RTA_DATA(tb_encap[SEG6_LOCAL_ACTION]); @@ -465,11 +465,11 @@ parse_encap_seg6local(struct rtattr *tb, static int parse_encap_seg6(struct rtattr *tb, struct in6_addr *segs) { - struct rtattr *tb_encap[256] = {}; + struct rtattr *tb_encap[SEG6_IPTUNNEL_MAX + 1] = {}; struct seg6_iptunnel_encap *ipt = NULL; struct in6_addr *segments = NULL; - netlink_parse_rtattr_nested(tb_encap, 256, tb); + netlink_parse_rtattr_nested(tb_encap, SEG6_IPTUNNEL_MAX, tb); /* * TODO: It's not support multiple SID list. |