To: vim-dev@vim.org Subject: Patch 6.1.305 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.305 Problem: When 'verbose' is 14 or higher, a function call may cause reading uninitialized data. (Walter Briscoe) Solution: Check for end-of-string in trunc_string(). Files: src/message.c *** ../vim61.304/src/message.c Mon Jan 6 21:55:57 2003 --- src/message.c Fri Jan 24 23:21:30 2003 *************** *** 204,210 **** } /* ! * Truncate a string "s" to "buf" with cell width "room". * "s" and "buf" may be equal. */ void --- 204,210 ---- } /* ! * Truncate a string "s" to "buf" with cell width "room". * "s" and "buf" may be equal. */ void *************** *** 226,231 **** --- 226,237 ---- /* First part: Start of the string. */ for (e = 0; len < half; ++e) { + if (s[e] == NUL) + { + /* text fits without truncating! */ + buf[e] = NUL; + return; + } n = ptr2cells(s + e); if (len + n >= half) break; *** ../vim61.304/src/version.c Tue Jan 28 21:38:14 2003 --- src/version.c Tue Jan 28 21:41:15 2003 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 305, /**/ -- hundred-and-one symptoms of being an internet addict: 66. You create a homepage with the impression to cure the afflicted...but your hidden agenda is to receive more e-mail. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///