]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
object: Avoid obj_ops array overrun
authorPhil Sutter <phil@nwl.cc>
Thu, 20 Dec 2018 20:03:27 +0000 (21:03 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 21 Dec 2018 11:04:40 +0000 (12:04 +0100)
In version 1.1.1, obj_ops array was smaller than __NFT_OBJECT_MAX since
there are no ops for NFT_OBJECT_CONNLIMIT. Avoid this potential issue in
the future by defining the array size.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/object.c

index e88203a82441eced1a41905528438c7fa19ccbf9..5c8d1835ca97ee207c7517df31fd36ac5de948b9 100644 (file)
@@ -25,7 +25,7 @@
 #include <buffer.h>
 #include "obj.h"
 
-static struct obj_ops *obj_ops[] = {
+static struct obj_ops *obj_ops[__NFT_OBJECT_MAX] = {
        [NFT_OBJECT_COUNTER]    = &obj_ops_counter,
        [NFT_OBJECT_QUOTA]      = &obj_ops_quota,
        [NFT_OBJECT_CT_HELPER]  = &obj_ops_ct_helper,