diff src/buffer.c @ 2704:a14db0b78c59 v7.3.121

updated for version 7.3.121 Problem: Complicated 'statusline' causes a crash. (Christian Brabandt) Solution: Check that the number of items is not too big.
author Bram Moolenaar <bram@vim.org>
date Tue, 15 Feb 2011 14:24:46 +0100
parents fcea35e2a41f
children c5e47b752f07
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3460,6 +3460,18 @@ build_stl_str_hl(wp, out, outlen, fmt, u
     prevchar_isitem = FALSE;
     for (s = usefmt; *s; )
     {
+	if (curitem == STL_MAX_ITEM)
+	{
+	    /* There are too many items.  Add the error code to the statusline
+	     * to give the user a hint about what went wrong. */
+	    if (p + 6 < out + outlen)
+	    {
+		mch_memmove(p, " E541", (size_t)5);
+		p += 5;
+	    }
+	    break;
+	}
+
 	if (*s != NUL && *s != '%')
 	    prevchar_isflag = prevchar_isitem = FALSE;