diff src/quickfix.c @ 13066:617112037564 v8.0.1408

patch 8.0.1408: crash in setqflist() commit https://github.com/vim/vim/commit/a0ca7d002d4efcf4bce0af6943146a339677ed3d Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 19 10:22:19 2017 +0100 patch 8.0.1408: crash in setqflist() Problem: Crash in setqflist(). Solution: Check for string to be NULL. (Dominique Pelle, closes https://github.com/vim/vim/issues/2464)
author Christian Brabandt <cb@256bit.org>
date Tue, 19 Dec 2017 10:30:05 +0100
parents 6479dadcf214
children 66c014c71dad
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -4930,8 +4930,9 @@ qf_get_properties(win_T *wp, dict_T *wha
 			qf_idx = -1;
 		}
 	    }
-	    else if ((di->di_tv.v_type == VAR_STRING)
-		    && (STRCMP(di->di_tv.vval.v_string, "$") == 0))
+	    else if (di->di_tv.v_type == VAR_STRING
+			    && di->di_tv.vval.v_string != NULL
+			    && STRCMP(di->di_tv.vval.v_string, "$") == 0)
 		/* Get the last quickfix list number */
 		qf_idx = qi->qf_listcount - 1;
 	    else
@@ -5226,7 +5227,8 @@ qf_set_properties(qf_info_T *qi, dict_T 
 		newlist = FALSE;	/* use the specified list */
 	}
 	else if (di->di_tv.v_type == VAR_STRING
-		&& STRCMP(di->di_tv.vval.v_string, "$") == 0)
+			&& di->di_tv.vval.v_string != NULL
+			&& STRCMP(di->di_tv.vval.v_string, "$") == 0)
 	{
 	    if (qi->qf_listcount > 0)
 		qf_idx = qi->qf_listcount - 1;