diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-18 13:05:18 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-18 13:05:18 +0200 |
commit | 0d3cb73012332964e7a81d7afd1c21d393f45566 (patch) | |
tree | f88c8cf7b3b4007b8ba2a064b7b143e8785c39f2 /src/change.c | |
parent | 8055d17388736421d875dd4933c4c93d49a2ab58 (diff) | |
download | vim-git-0d3cb73012332964e7a81d7afd1c21d393f45566.tar.gz |
patch 8.1.1344: Coverity complains about possibly using a NULL pointerv8.1.1344
Problem: Coverity complains about possibly using a NULL pointer and copying
a string into a fixed size buffer.
Solution: Check for NULL, even though it should not happen. Use
vim_strncpy() instead of strcpy().
Diffstat (limited to 'src/change.c')
-rw-r--r-- | src/change.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/change.c b/src/change.c index f1c3cc4d0..33db0c1b8 100644 --- a/src/change.c +++ b/src/change.c @@ -193,12 +193,16 @@ check_recorded_changes( // can be merged. di = dict_find(li->li_tv.vval.v_dict, (char_u *)"end", -1); - nr = tv_get_number(&di->di_tv); - if (lnume > nr) - di->di_tv.vval.v_number = lnume; + if (di != NULL) + { + nr = tv_get_number(&di->di_tv); + if (lnume > nr) + di->di_tv.vval.v_number = lnume; + } di = dict_find(li->li_tv.vval.v_dict, (char_u *)"added", -1); - di->di_tv.vval.v_number += xtra; + if (di != NULL) + di->di_tv.vval.v_number += xtra; return TRUE; } } |