To: vim-dev@vim.org Subject: Patch 6.0.100 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.100 Problem: ":badd +0 test%file" causes a crash. Solution: Take into account that the "+0" is NUL terminated when allocating room for replacing the "%". Files: src/ex_docmd.c *** ../vim60.99/src/ex_docmd.c Fri Nov 2 16:29:44 2001 --- src/ex_docmd.c Sat Dec 15 21:34:01 2001 *************** *** 3330,3336 **** /* * Replace part of the command line, keeping eap->cmd, eap->arg and * eap->nextcmd correct. ! * "src" points to the part that is to be replaced, of lenght "srclen". * "repl" is the replacement string. * Returns a pointer to the character after the replaced string. * Returns NULL for failure. --- 3330,3336 ---- /* * Replace part of the command line, keeping eap->cmd, eap->arg and * eap->nextcmd correct. ! * "src" points to the part that is to be replaced, of length "srclen". * "repl" is the replacement string. * Returns a pointer to the character after the replaced string. * Returns NULL for failure. *************** *** 3350,3358 **** /* * The new command line is build in new_cmdline[]. * First allocate it. */ len = (int)STRLEN(repl); ! i = (int)STRLEN(*cmdlinep) + len + 3; if (eap->nextcmd) i += (int)STRLEN(eap->nextcmd);/* add space for next command */ if ((new_cmdline = alloc((unsigned)i)) == NULL) --- 3350,3359 ---- /* * The new command line is build in new_cmdline[]. * First allocate it. + * Careful: a "+cmd" argument may have been NUL terminated. */ len = (int)STRLEN(repl); ! i = (int)(src - *cmdlinep) + (int)STRLEN(src + srclen) + len + 3; if (eap->nextcmd) i += (int)STRLEN(eap->nextcmd);/* add space for next command */ if ((new_cmdline = alloc((unsigned)i)) == NULL) *** ../vim60.99/src/version.c Sat Dec 15 21:39:19 2001 --- src/version.c Sat Dec 15 21:05:08 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 100, /**/ -- hundred-and-one symptoms of being an internet addict: 116. You are living with your boyfriend who networks your respective computers so you can sit in separate rooms and email each other /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///