aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2014-11-15 20:51:18 +0300
committerZyX <kp-pav@yandex.ru>2016-04-18 02:43:43 +0300
commitc0bab19cf5aeb2533e0995a44283088b95a5a531 (patch)
treef74265f8c4c512a2f8a0dad9dc05b564ac097a87
parent9261f1597ff9ffbbb546dc308bdeaabd191577e9 (diff)
downloadrneovim-c0bab19cf5aeb2533e0995a44283088b95a5a531.tar.gz
rneovim-c0bab19cf5aeb2533e0995a44283088b95a5a531.tar.bz2
rneovim-c0bab19cf5aeb2533e0995a44283088b95a5a531.zip
option: Allow zero-length options
Code that expected NUL-terminated strings allowed them and this behaviour is actually used.
-rw-r--r--src/nvim/option.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index fe205f4e63..314ad0b035 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -4309,13 +4309,12 @@ int findoption_len(const char_u *const arg, const size_t len)
}
}
- assert(len > 0);
-
/*
* Check for name starting with an illegal character.
*/
- if (arg[0] < 'a' || arg[0] > 'z')
+ if (len == 0 || arg[0] < 'a' || arg[0] > 'z') {
return -1;
+ }
int opt_idx;
is_term_opt = (len > 2 && arg[0] == 't' && arg[1] == '_');