diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-08-29 10:06:35 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-09-05 08:04:15 +0200 |
commit | db17d2c0fa2f82edc486ec7954e174404a115036 (patch) | |
tree | a41fb16189a0f17b591e694eca4482452828e471 /src/nvim/api/vim.c | |
parent | 9fe8e3cb2f357ea38d53b5d83b3ea0ebf98be58a (diff) | |
download | rneovim-db17d2c0fa2f82edc486ec7954e174404a115036.tar.gz rneovim-db17d2c0fa2f82edc486ec7954e174404a115036.tar.bz2 rneovim-db17d2c0fa2f82edc486ec7954e174404a115036.zip |
API: Avoid overrun when formatting error-message
msgpack_rpc_to_object (called by handle_request .. msgpack_rpc_to_array)
always NUL-terminates API Strings.
But handle_request .. msgpack_rpc_get_handler_for operates on a raw
msgpack_object, before preparation.
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index e78b8c776d..fed20a272a 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -502,7 +502,7 @@ Integer nvim_strwidth(String text, Error *err) FUNC_API_SINCE(1) { if (text.size > INT_MAX) { - api_set_error(err, kErrorTypeValidation, "String length is too high"); + api_set_error(err, kErrorTypeValidation, "String is too long"); return 0; } @@ -559,7 +559,7 @@ void nvim_set_current_dir(String dir, Error *err) FUNC_API_SINCE(1) { if (dir.size >= MAXPATHL) { - api_set_error(err, kErrorTypeValidation, "Directory string is too long"); + api_set_error(err, kErrorTypeValidation, "Directory name is too long"); return; } @@ -1136,14 +1136,14 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err) if (calls.items[i].type != kObjectTypeArray) { api_set_error(err, kErrorTypeValidation, - "All items in calls array must be arrays"); + "Items in calls array must be arrays"); goto validation_error; } Array call = calls.items[i].data.array; if (call.size != 2) { api_set_error(err, kErrorTypeValidation, - "All items in calls array must be arrays of size 2"); + "Items in calls array must be arrays of size 2"); goto validation_error; } |