]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0812: Coverity warns about dereferencing NULL ptr v9.1.0812
authorChristian Brabandt <cb@256bit.org>
Wed, 23 Oct 2024 19:32:31 +0000 (21:32 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 23 Oct 2024 19:32:31 +0000 (21:32 +0200)
Problem:  Coverity warns about dereferencing NULL ptr
          in check_colorcolumn()
Solution: verify that wp is not null before accessing it

related: #15914

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

index 226a05eeddd94cb758ba905e7f7851d7dde787ee..1f66cef8adfa59cabec86d1fd4ae1da4eb7e16d8 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    812,
 /**/
     811,
 /**/
index 5a8dc2e9e63b9167160c4f1824c567703db1ca84..7c8f4fb366849f8bd0f9546fd3f26d6e0741f5a3 100644 (file)
@@ -7934,7 +7934,7 @@ check_colorcolumn(
     char_u *cc,                // when NULL: use "wp->w_p_cc"
     win_T *wp)         // when NULL: only parse "cc"
 {
-    char_u     *s;
+    char_u     *s = empty_option;
     int                tw;
     int                col;
     int                count = 0;
@@ -7947,7 +7947,7 @@ check_colorcolumn(
 
     if (cc != NULL)
        s = cc;
-    else
+    else if (wp != NULL)
        s = wp->w_p_cc;
 
     if (wp != NULL)