To: vim_dev@googlegroups.com Subject: Patch 8.2.1896 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1896 Problem: Valgrind warns for using uninitialized memory. Solution: NUL terminate the SmcOpenConnection() error message. (Dominique Pellé, closes #7194) Files: src/os_unix.c *** ../vim-8.2.1895/src/os_unix.c 2020-10-09 23:04:43.676144228 +0200 --- src/os_unix.c 2020-10-24 13:29:02.516565586 +0200 *************** *** 8068,8077 **** errorstring); if (xsmp.smcconn == NULL) { - char errorreport[132]; - if (p_verbose > 0) { vim_snprintf(errorreport, sizeof(errorreport), _("XSMP SmcOpenConnection failed: %s"), errorstring); verb_msg(errorreport); --- 8068,8080 ---- errorstring); if (xsmp.smcconn == NULL) { 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); *** ../vim-8.2.1895/src/version.c 2020-10-23 18:51:03.531271374 +0200 --- src/version.c 2020-10-24 13:30:31.956285408 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1896, /**/ -- "Computers in the future may weigh no more than 1.5 tons." Popular Mechanics, 1949 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///