[libnftnl PATCH 3/4] expr: ct: Delete the last comma character in json text.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Code refactoring to delete correctly the last comma character in json text.

Signed-off-by: Ana Rey <anarey@xxxxxxxxx>
---
 src/expr/ct.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/expr/ct.c b/src/expr/ct.c
index 49fe238..f2718f9 100644
--- a/src/expr/ct.c
+++ b/src/expr/ct.c
@@ -356,9 +356,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
-- 
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




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux