aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-03-21 07:42:41 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-03-21 07:44:52 -0400
commit5c97bfb1e2149b0274721b4bde55b63f892548cf (patch)
treeabbdbde2f64d0670d9c10ff82aa60c5688d90abb /src
parentc5631338b16b2a21e0abbbc54494f660f6e7fb76 (diff)
downloadrneovim-5c97bfb1e2149b0274721b4bde55b63f892548cf.tar.gz
rneovim-5c97bfb1e2149b0274721b4bde55b63f892548cf.tar.bz2
rneovim-5c97bfb1e2149b0274721b4bde55b63f892548cf.zip
vim-patch:8.1.1025: checking NULL pointer after addition
Problem: Checking NULL pointer after addition. (Coverity) Solution: First check for NULL, then add the column. https://github.com/vim/vim/commit/64c8ed366de995a01ca1a072a6943ede0d7bb932
Diffstat (limited to 'src')
-rw-r--r--src/nvim/regexp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index ab1a7c7b3e..c602e7df0f 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -6963,10 +6963,11 @@ char_u *reg_submatch(int no)
return NULL;
}
- s = reg_getline_submatch(lnum) + rsm.sm_mmatch->startpos[no].col;
+ s = reg_getline_submatch(lnum);
if (s == NULL) { // anti-crash check, cannot happen?
break;
}
+ s += rsm.sm_mmatch->startpos[no].col;
if (rsm.sm_mmatch->endpos[no].lnum == lnum) {
// Within one line: take form start to end col.
len = rsm.sm_mmatch->endpos[no].col - rsm.sm_mmatch->startpos[no].col;