aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-01-15 12:05:00 +0800
committerGitHub <noreply@github.com>2025-01-15 12:05:00 +0800
commita78eddd54112033eea0212865efd2f75cc59fc93 (patch)
tree22a32a034c5f564263c786b2534020e2df2a408a /src
parent611ef354919f1c6564efd2ff8074545941458ccc (diff)
downloadrneovim-a78eddd54112033eea0212865efd2f75cc59fc93.tar.gz
rneovim-a78eddd54112033eea0212865efd2f75cc59fc93.tar.bz2
rneovim-a78eddd54112033eea0212865efd2f75cc59fc93.zip
vim-patch:9.1.1015: Coverity complains about dereferencing NULL value (#32020)
Problem: Coverity complains about dereferencing NULL value Solution: Check that cms2 is not null closes: vim/vim#16438 https://github.com/vim/vim/commit/1ac53b84ada3a992f320566737e66fa00d48611f Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fold.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index c9699cb161..b59933d600 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1658,7 +1658,7 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char *marker, size_t marker
if (*cms != NUL) {
// Also delete 'commentstring' if it matches.
char *cms2 = strstr(cms, "%s");
- if (p - line >= cms2 - cms
+ if (cms2 != NULL && p - line >= cms2 - cms
&& strncmp(p - (cms2 - cms), cms, (size_t)(cms2 - cms)) == 0
&& strncmp(p + len, cms2 + 2, strlen(cms2 + 2)) == 0) {
p -= cms2 - cms;