changeset 22695:fa0aac214da6 v8.2.1896

patch 8.2.1896: valgrind warns for using uninitialized memory Commit: https://github.com/vim/vim/commit/e1be11864d1f4383171e3af3eb77e61d41140c4e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 24 13:30:51 2020 +0200 patch 8.2.1896: valgrind warns for using uninitialized memory Problem: Valgrind warns for using uninitialized memory. Solution: NUL terminate the SmcOpenConnection() error message. (Dominique Pell?, closes #7194)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Oct 2020 13:45:04 +0200
parents fe872013002c
children 919563736398
files src/os_unix.c src/version.c
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -8068,10 +8068,13 @@ xsmp_init(void)
 	    errorstring);
     if (xsmp.smcconn == NULL)
     {
-	char errorreport[132];
-
 	if (p_verbose > 0)
 	{
+	    char errorreport[132];
+
+	    // If the message is too long it might not be NUL terminated.  Add
+	    // a NUL at the end to make sure we don't go over the end.
+	    errorstring[sizeof(errorstring) - 1] = NUL;
 	    vim_snprintf(errorreport, sizeof(errorreport),
 			 _("XSMP SmcOpenConnection failed: %s"), errorstring);
 	    verb_msg(errorreport);
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1896,
+/**/
     1895,
 /**/
     1894,