aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/indent_c.c2
-rw-r--r--src/nvim/testdir/test_cindent.vim7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 6f75183a5a..e6dc985726 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -150,7 +150,7 @@ static const char_u *skip_string(const char_u *p)
i++;
}
}
- if (p[i] == '\'') { // check for trailing '
+ if (p[i - 1] != NUL && p[i] == '\'') { // check for trailing '
p += i;
continue;
}
diff --git a/src/nvim/testdir/test_cindent.vim b/src/nvim/testdir/test_cindent.vim
index 4d69aed96c..7ba8ef3397 100644
--- a/src/nvim/testdir/test_cindent.vim
+++ b/src/nvim/testdir/test_cindent.vim
@@ -5311,6 +5311,13 @@ func Test_cindent_case()
bwipe!
endfunc
+" This was reading past the end of the line
+func Test_cindent_check_funcdecl()
+ new
+ sil norm o0('\0=L
+ bwipe!
+endfunc
+
func Test_cindent_scopedecls()
new
setl cindent ts=4 sw=4