diff src/message.c @ 10158:dd0531938cb6 v7.4.2349

commit https://github.com/vim/vim/commit/2321ca2a78286bc026fa7f407281ddbeb04114bb Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 9 14:17:18 2016 +0200 patch 7.4.2349 Problem: Valgrind reports using uninitialzed memory. (Dominique Pelle) Solution: Check the length before checking for a NUL.
author Christian Brabandt <cb@256bit.org>
date Fri, 09 Sep 2016 14:30:08 +0200
parents b67088aae933
children 66f1b5bf3fa6
line wrap: on
line diff
--- a/src/message.c
+++ b/src/message.c
@@ -2462,7 +2462,7 @@ msg_puts_printf(char_u *str, int maxlen)
     if (!(silent_mode && p_verbose == 0))
 	mch_settmode(TMODE_COOK);	/* handle '\r' and '\n' correctly */
 #endif
-    while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
+    while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
     {
 	if (!(silent_mode && p_verbose == 0))
 	{