neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit adfad50ac03030abf2533db9f56fa681af6cdc1f
parent 363d153bb94a965ff811d8c7514047264b37d61d
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Thu, 19 Jan 2023 20:38:29 +0800

fix(rpc): don't parse msgpack if buflen is 0 (#21899)

This prevents `buflen` from becoming a very large number when it is 0
when calling mpack_rtoken().
Diffstat:
Msrc/mpack/mpack_core.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mpack/mpack_core.c b/src/mpack/mpack_core.c @@ -173,6 +173,9 @@ MPACK_API int mpack_write(mpack_tokbuf_t *tokbuf, char **buf, size_t *buflen, int mpack_rtoken(const char **buf, size_t *buflen, mpack_token_t *tok) { + if (*buflen == 0) { + return MPACK_EOF; + } unsigned char t = ADVANCE(buf, buflen); if (t < 0x80) { /* positive fixint */