summaryrefslogtreecommitdiffstats
path: root/src/expr
diff options
context:
space:
mode:
authorAna Rey <anarey@gmail.com>2014-06-24 08:46:39 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2014-06-24 10:36:21 +0200
commitfe8ba5890b9eeca889298b59de75c47db7b4ae89 (patch)
tree5b2f9bc4aefc4c0cfa984a7a0e18f4cf20eb45ea /src/expr
parent2a725335fca2d3d2cbb13f93119a8f4c0194b16e (diff)
expr: ct: Delete the last comma character in json text
Code refactoring to delete correctly the last comma character in json text. Signed-off-by: Ana Rey <anarey@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr')
-rw-r--r--src/expr/ct.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/expr/ct.c b/src/expr/ct.c
index 2c28beb..caabdbc 100644
--- a/src/expr/ct.c
+++ b/src/expr/ct.c
@@ -358,9 +358,10 @@ nft_expr_ct_snprintf_json(char *buf, size_t size, struct nft_rule_expr *e)
}
/* Remove the last separator characther */
- buf[offset-1] = '\0';
+ if (offset > 0)
+ offset--;
- return offset-1;
+ return offset;
}
static int