mirror of
https://github.com/neovim/neovim.git
synced 2026-08-25 00:21:55 +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:
@@ -40,7 +40,8 @@ MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
|
||||
map_get(String, MsgpackRpcRequestHandler)(methods, m);
|
||||
|
||||
if (!rv.fn) {
|
||||
api_set_error(error, kErrorTypeException, "Invalid method: %s",
|
||||
api_set_error(error, kErrorTypeException, "Invalid method: %.*s",
|
||||
m.size > 0 ? m.size : sizeof("<empty>"),
|
||||
m.size > 0 ? m.data : "<empty>");
|
||||
}
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user