mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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
1ac53b84ad
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
611ef35491
commit
a78eddd541
@ -1658,7 +1658,7 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char *marker, size_t marker
|
|||||||
if (*cms != NUL) {
|
if (*cms != NUL) {
|
||||||
// Also delete 'commentstring' if it matches.
|
// Also delete 'commentstring' if it matches.
|
||||||
char *cms2 = strstr(cms, "%s");
|
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 - (cms2 - cms), cms, (size_t)(cms2 - cms)) == 0
|
||||||
&& strncmp(p + len, cms2 + 2, strlen(cms2 + 2)) == 0) {
|
&& strncmp(p + len, cms2 + 2, strlen(cms2 + 2)) == 0) {
|
||||||
p -= cms2 - cms;
|
p -= cms2 - cms;
|
||||||
|
Loading…
Reference in New Issue
Block a user