diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-09-27 16:03:37 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-09-27 16:04:30 +0200 |
commit | 7834cbfd827474d31437218b866e13c6e72436c6 (patch) | |
tree | cb5a0aeb2f734104959baf73d4b63021199b2a07 /src/set.c | |
parent | a54e60a541f009639d596e1fecaeeab67683d258 (diff) |
set: json: fix returned string length
Similar to (e7c068d rule: json: fix returned string length).
Based on patch from Arturo.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/set.c')
-rw-r--r-- | src/set.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -579,6 +579,8 @@ static int nft_set_snprintf_json(char *buf, size_t size, struct nft_set *s, ret = snprintf(buf+offset, len, "}, "); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); } + /* Overwrite trailing ", " from last set element */ + offset -= 2; ret = snprintf(buf+offset, len, "]}}"); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); |