changeset 2694:fcea35e2a41f v7.3.112

updated for version 7.3.112 Problem: Setting 'statusline' to "%!'asdf%' reads uninitialized memory. Solution: Check for NUL after %.
author Bram Moolenaar <bram@vim.org>
date Tue, 01 Feb 2011 21:55:01 +0100
parents 0606065af0a0
children b0605f2f9786
files src/buffer.c src/version.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3364,7 +3364,8 @@ free_titles()
  * or truncated if too long, fillchar is used for all whitespace.
  */
     int
-build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab)
+build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar,
+						      maxwidth, hltab, tabtab)
     win_T	*wp;
     char_u	*out;		/* buffer to write into != NameBuff */
     size_t	outlen;		/* length of out[] */
@@ -3474,6 +3475,8 @@ build_stl_str_hl(wp, out, outlen, fmt, u
 	 * Handle one '%' item.
 	 */
 	s++;
+	if (*s == NUL)  /* ignore trailing % */
+	    break;
 	if (*s == '%')
 	{
 	    if (p + 1 >= out + outlen)
--- a/src/version.c
+++ b/src/version.c
@@ -715,6 +715,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    112,
+/**/
     111,
 /**/
     110,