aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-01-03 16:13:21 +0300
committerZyX <kp-pav@yandex.ru>2017-01-03 16:13:21 +0300
commitf21725946c575884e04e79942850e7d0bc040ef9 (patch)
treecc6f865019c14243311abf719a3fa59dd0bfcf1a /src
parent06cca5dc59ae3bcfb81796b331a3f882ba1f0ca2 (diff)
downloadrneovim-f21725946c575884e04e79942850e7d0bc040ef9.tar.gz
rneovim-f21725946c575884e04e79942850e7d0bc040ef9.tar.bz2
rneovim-f21725946c575884e04e79942850e7d0bc040ef9.zip
eval/encode: Fail when stringifying NULL functions
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval/encode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index ef1e77459a..828bde3124 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -336,8 +336,14 @@ int encode_read_from_list(ListReaderState *const state, char *const buf,
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
do { \
- ga_concat(gap, "function("); \
- TYPVAL_ENCODE_CONV_STRING(tv, fun, STRLEN(fun)); \
+ const char *const fun_ = (const char *)(fun); \
+ if (fun_ == NULL) { \
+ EMSG2(_(e_intern2), "string(): NULL function name"); \
+ ga_concat(gap, "function(NULL"); \
+ } else { \
+ ga_concat(gap, "function("); \
+ TYPVAL_ENCODE_CONV_STRING(tv, fun_, strlen(fun_)); \
+ }\
} while (0)
#define TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS(tv, len) \