neovim

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

commit 1e47aa677a24231ec771137dadc7c2b65be775b4
parent 5135a232199047e473e3941b0b5a738c77fbecb5
Author: Famiu Haque <famiuhaque@proton.me>
Date:   Thu,  9 Jan 2025 21:32:27 +0600

fix(api): deprecated API nvim_get_option does not validate option name #31919

Problem:
Deprecated API `nvim_get_option()` doesn't validate the option name,
which leads to an assertion failure.

Solution:
Validate option name in `nvim_get_option()`.

Ref: #31894
Diffstat:
Msrc/nvim/api/deprecated.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c @@ -648,6 +648,10 @@ static Object get_option_from(void *from, OptScope scope, String name, Error *er }); OptIndex opt_idx = find_option(name.data); + VALIDATE_S(opt_idx != kOptInvalid, "option name", name.data, { + return (Object)OBJECT_INIT; + }); + OptVal value = NIL_OPTVAL; if (option_has_scope(opt_idx, scope)) {