diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-04-12 21:19:04 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-04-12 21:19:04 +0200 |
commit | 04af19637c14045fa33b99576de4eea1e3524edb (patch) | |
tree | 8548d69f19d74f118915299f76ce9c33e0ce0f88 /src/json.c | |
parent | f9b89b467965802b8d14251c0dd944343796edcd (diff) |
patch 8.1.1158: json encoded string is sometimes missing the final NULv8.1.1158
Problem: Json encoded string is sometimes missing the final NUL.
Solution: Add the NUL. Also for log messages.
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/json.c b/src/json.c index d3c4817be5..9fb6af0def 100644 --- a/src/json.c +++ b/src/json.c @@ -51,6 +51,7 @@ json_encode(typval_T *val, int options) /* Store bytes in the growarray. */ ga_init2(&ga, 1, 4000); json_encode_gap(&ga, val, options); + ga_append(&ga, NUL); return ga.ga_data; } @@ -82,6 +83,7 @@ json_encode_nr_expr(int nr, typval_T *val, int options) if (json_encode_gap(&ga, &listtv, options) == OK && (options & JSON_NL)) ga_append(&ga, '\n'); list_unref(listtv.vval.v_list); + ga_append(&ga, NUL); return ga.ga_data; } #endif |