From 77d244245c5b923b4cc8c88c9ad99291f6bba4c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Falgueras=20Garc=C3=ADa?= Date: Mon, 15 Aug 2016 12:51:02 +0200 Subject: utils: Fix out of bound access in nftnl_family2str MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checks array limits before access it and adds a missed translation. Signed-off-by: Carlos Falgueras GarcĂ­a Signed-off-by: Pablo Neira Ayuso --- src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index e2715a2..f0f5467 100644 --- a/src/utils.c +++ b/src/utils.c @@ -33,7 +33,7 @@ static const char *const nftnl_family_str[NFPROTO_NUMPROTO] = { const char *nftnl_family2str(uint32_t family) { - if (nftnl_family_str[family] == NULL) + if (family >= NFPROTO_NUMPROTO || !nftnl_family_str[family]) return "unknown"; return nftnl_family_str[family]; -- cgit v1.2.3