summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rule.c b/src/rule.c
index b4ce8f1..5fd8814 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -745,7 +745,9 @@ static int nft_rule_snprintf_json(char *buf, size_t size, struct nft_rule *r,
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
}
- ret = snprintf(buf+offset-1, len, "]}}");
+ /* Remove comma from last element */
+ offset--;
+ ret = snprintf(buf+offset, len, "]}}");
SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
return offset;