]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
expr: cmp: Use cmp2str() instead of directly access to array
authorCarlos Falgueras García <carlosfg@riseup.net>
Mon, 15 Aug 2016 10:51:03 +0000 (12:51 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 Aug 2016 11:48:03 +0000 (13:48 +0200)
Uses cmp2str() which checks array bounds.

Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expr/cmp.c

index f3dd62c9d08bde6b5c2192e9b1a54f0f7da0610e..5d51958cb3f181975f2ad8dd5497e75bab87331e 100644 (file)
@@ -267,7 +267,7 @@ static int nftnl_expr_cmp_snprintf_default(char *buf, size_t size,
        int len = size, offset = 0, ret;
 
        ret = snprintf(buf, len, "%s reg %u ",
-                      expr_cmp_str[cmp->op], cmp->sreg);
+                      cmp2str(cmp->op), cmp->sreg);
        SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
        ret = nftnl_data_reg_snprintf(buf+offset, len, &cmp->data,