summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Falgueras García <carlosfg@riseup.net>2016-08-15 12:51:02 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-08-15 13:47:56 +0200
commit77d244245c5b923b4cc8c88c9ad99291f6bba4c1 (patch)
treebdcdece44e7bf1ff97a189d1a893d39f3dff8c8c
parentd9f68d62681fba81e0fe428647ae3a7a0ce659c0 (diff)
utils: Fix out of bound access in nftnl_family2str
Checks array limits before access it and adds a missed translation. Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/utils.c2
1 files changed, 1 insertions, 1 deletions
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];