mirror of
https://github.com/neovim/neovim.git
synced 2026-04-20 22:35:33 +00:00
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.
This commit is contained in:
@@ -309,7 +309,7 @@ describe('api/buf', function()
|
||||
eq(1, funcs.exists('b:lua'))
|
||||
curbufmeths.del_var('lua')
|
||||
eq(0, funcs.exists('b:lua'))
|
||||
eq({false, 'Key does not exist: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
|
||||
eq({false, 'Key not found: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
|
||||
curbufmeths.set_var('lua', 1)
|
||||
command('lockvar b:lua')
|
||||
eq({false, 'Key is locked: lua'}, meth_pcall(curbufmeths.del_var, 'lua'))
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('api/tabpage', function()
|
||||
eq(1, funcs.exists('t:lua'))
|
||||
curtabmeths.del_var('lua')
|
||||
eq(0, funcs.exists('t:lua'))
|
||||
eq({false, 'Key does not exist: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
|
||||
eq({false, 'Key not found: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
|
||||
curtabmeths.set_var('lua', 1)
|
||||
command('lockvar t:lua')
|
||||
eq({false, 'Key is locked: lua'}, meth_pcall(curtabmeths.del_var, 'lua'))
|
||||
|
||||
@@ -337,7 +337,7 @@ describe('API', function()
|
||||
eq(1, funcs.exists('g:lua'))
|
||||
meths.del_var('lua')
|
||||
eq(0, funcs.exists('g:lua'))
|
||||
eq({false, 'Key does not exist: lua'}, meth_pcall(meths.del_var, 'lua'))
|
||||
eq({false, "Key not found: lua"}, meth_pcall(meths.del_var, 'lua'))
|
||||
meths.set_var('lua', 1)
|
||||
command('lockvar lua')
|
||||
eq({false, 'Key is locked: lua'}, meth_pcall(meths.del_var, 'lua'))
|
||||
@@ -948,7 +948,7 @@ describe('API', function()
|
||||
}
|
||||
local status, err = pcall(meths.call_atomic, req)
|
||||
eq(false, status)
|
||||
ok(err:match(' All items in calls array must be arrays of size 2') ~= nil)
|
||||
ok(err:match('Items in calls array must be arrays of size 2') ~= nil)
|
||||
-- call before was done, but not after
|
||||
eq(1, meths.get_var('avar'))
|
||||
|
||||
@@ -958,7 +958,7 @@ describe('API', function()
|
||||
}
|
||||
status, err = pcall(meths.call_atomic, req)
|
||||
eq(false, status)
|
||||
ok(err:match('All items in calls array must be arrays') ~= nil)
|
||||
ok(err:match('Items in calls array must be arrays') ~= nil)
|
||||
eq({2,3}, meths.get_var('bvar'))
|
||||
|
||||
req = {
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('api/win', function()
|
||||
eq(1, funcs.exists('w:lua'))
|
||||
curwinmeths.del_var('lua')
|
||||
eq(0, funcs.exists('w:lua'))
|
||||
eq({false, 'Key does not exist: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
|
||||
eq({false, 'Key not found: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
|
||||
curwinmeths.set_var('lua', 1)
|
||||
command('lockvar w:lua')
|
||||
eq({false, 'Key is locked: lua'}, meth_pcall(curwinmeths.del_var, 'lua'))
|
||||
|
||||
Reference in New Issue
Block a user