diff options
author | Famiu Haque <famiuhaque@proton.me> | 2025-01-09 21:32:27 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-09 07:32:27 -0800 |
commit | 1e47aa677a24231ec771137dadc7c2b65be775b4 (patch) | |
tree | 23b0c9ccf50e941cc78f1a739abcf65aaddd05aa | |
parent | 5135a232199047e473e3941b0b5a738c77fbecb5 (diff) | |
download | rneovim-1e47aa677a24231ec771137dadc7c2b65be775b4.tar.gz rneovim-1e47aa677a24231ec771137dadc7c2b65be775b4.tar.bz2 rneovim-1e47aa677a24231ec771137dadc7c2b65be775b4.zip |
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
-rw-r--r-- | src/nvim/api/deprecated.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/api/deprecated.c b/src/nvim/api/deprecated.c index 406d5e7b4f..5150aeebec 100644 --- 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)) { |