Code refactoring to delete correctly the last comma character in json text. Signed-off-by: Ana Rey <anarey@xxxxxxxxx> --- src/expr/meta.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/expr/meta.c b/src/expr/meta.c index 25026a9..95d538c 100644 --- a/src/expr/meta.c +++ b/src/expr/meta.c @@ -322,9 +322,10 @@ nft_rule_expr_meta_snprintf_json(char *buf, size_t size, } /* Remove the last separator characther */ - buf[offset-1] = '\0'; + if (offset > 0) + offset--; - return offset-1; + return offset; } static int -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html