]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1015: Coverity complains about dereferencing NULL value v9.1.1015
authorChristian Brabandt <cb@256bit.org>
Tue, 14 Jan 2025 16:25:02 +0000 (17:25 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 14 Jan 2025 16:25:02 +0000 (17:25 +0100)
Problem:  Coverity complains about dereferencing NULL value
Solution: Check that cms2 is not null

closes: #16438

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/fold.c
src/version.c

index 3353cc55feaed8bea3f9c0ef75f6d0b32b1ddba7..64f9447b721304983032548024a54aa5fdc6a373 100644 (file)
@@ -1879,7 +1879,7 @@ foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
            {
                // Also delete 'commentstring' if it matches.
                cms2 = (char_u *)strstr((char *)cms, "%s");
-               if (p - line >= cms2 - cms
+               if (cms2 != NULL && p - line >= cms2 - cms
                        && STRNCMP(p - (cms2 - cms), cms, cms2 - cms) == 0
                        && STRNCMP(p + len, cms2 + 2, STRLEN(cms2 + 2)) == 0)
                {
index 57d7ec7d407f8b3e86f744cebc76410db4cb0f78..96a51da8020022040deb42ed52d92a9e16bad4ec 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1015,
 /**/
     1014,
 /**/