mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
Avoid serializing NULL string through msgpack
Attempting to serialize a NULL string through msgpack results in msgpack_sbuffer_write attempting to memcpy from a NULL pointer, which is undefined behavior.
This commit is contained in:
@@ -326,7 +326,9 @@ void msgpack_rpc_from_string(String result, msgpack_packer *res)
|
||||
FUNC_ATTR_NONNULL_ARG(2)
|
||||
{
|
||||
msgpack_pack_str(res, result.size);
|
||||
msgpack_pack_str_body(res, result.data, result.size);
|
||||
if (result.size > 0) {
|
||||
msgpack_pack_str_body(res, result.data, result.size);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
Reference in New Issue
Block a user