[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20191024212043.17663-1-michal.lyszczek@bofc.pl>
Date: Thu, 24 Oct 2019 23:20:43 +0200
From: Michał Łyszczek <michal.lyszczek@...c.pl>
To: netdev@...r.kernel.org
Cc: Michał Łyszczek <michal.lyszczek@...c.pl>
Subject: [PATCH iproute2] rdma/sys.c: fix possible out-of-bound array access
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@...c.pl>
---
rdma/sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rdma/sys.c b/rdma/sys.c
index cef39081..1a434a25 100644
--- a/rdma/sys.c
+++ b/rdma/sys.c
@@ -31,7 +31,7 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)
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";
--
2.21.0
Powered by blists - more mailing lists