From 6285b518d4c56537991feff899b74274766086ca Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 23 Jul 2018 00:57:57 -0400 Subject: vim-patch:8.0.1622: possible NULL pointer dereference Problem: Possible NULL pointer dereferencey. (Coverity) Solution: Reverse the check for a NULL pointer. https://github.com/vim/vim/commit/6ed86ad170b60517eeddb54c2b22fdc888a22c0b --- src/nvim/quickfix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 47760e1e70..664dd3e968 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3603,15 +3603,16 @@ void ex_vimgrep(exarg_T *eap) goto theend; } - if (s != NULL && *s == NUL) { - /* Pattern is empty, use last search pattern. */ + if (s == NULL || *s == NUL) { + // Pattern is empty, use last search pattern. if (last_search_pat() == NULL) { EMSG(_(e_noprevre)); goto theend; } regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); - } else + } else { regmatch.regprog = vim_regcomp(s, RE_MAGIC); + } if (regmatch.regprog == NULL) goto theend; -- cgit