aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-16 20:26:47 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-18 21:57:48 +0100
commitbe90cdf4f9891ebd6cdf6b2ec6c34f3bcf465643 (patch)
treebf644bb67bb7c025d97987baab548235576a73ec /src/nvim/eval.c
parentd3f413ba6a4e9fc36712f787bc120eb028f39cae (diff)
downloadrneovim-be90cdf4f9891ebd6cdf6b2ec6c34f3bcf465643.tar.gz
rneovim-be90cdf4f9891ebd6cdf6b2ec6c34f3bcf465643.tar.bz2
rneovim-be90cdf4f9891ebd6cdf6b2ec6c34f3bcf465643.zip
Fix warnings: eval.c: dictitem_alloc(): Out-of-bounds access: FP.
Problem : Out-of-bound array access @ 5737. Diagnostic : False positive. Rationale : Situation is intentional. `dictitem_T` is a prefix all dict items whill share, but actual size of each item will be different depending on its key length. `di_key` array field is declared of size 1 just to have a field name, but real size will vary for each item. Resolution : Make analyzer ignore it. This could be refactored to use C99-allowed variable length arrays, but eval.c is bound to dissappear, so no effort is done in that sense.
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index d7f820ae78..9acde49105 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -5734,7 +5734,9 @@ dict_free (
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
{
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
+#ifndef __clang_analyzer__
STRCPY(di->di_key, key);
+#endif
di->di_flags = 0;
return di;
}