netns_modes_str[] array has 2 elements, when netns_mode is 2,
condition (2 <= 2) will be true and `mode_str = netns_modes_str[2]'
will be executed, which will result in out-of-bound read.
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
netns_mode =
mnl_attr_get_u8(tb[RDMA_NLDEV_SYS_ATTR_NETNS_MODE]);
- if (netns_mode <= ARRAY_SIZE(netns_modes_str))
+ if (netns_mode < ARRAY_SIZE(netns_modes_str))
mode_str = netns_modes_str[netns_mode];
else
mode_str = "unknown";