|
Karsten Hopp |
80d3d2 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
80d3d2 |
Subject: Patch 7.3.648
|
|
Karsten Hopp |
80d3d2 |
Fcc: outbox
|
|
Karsten Hopp |
80d3d2 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
80d3d2 |
Mime-Version: 1.0
|
|
Karsten Hopp |
80d3d2 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
80d3d2 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
80d3d2 |
------------
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
Patch 7.3.648
|
|
Karsten Hopp |
80d3d2 |
Problem: Crash when using a very long file name. (ZyX)
|
|
Karsten Hopp |
80d3d2 |
Solution: Properly check length of buffer space.
|
|
Karsten Hopp |
80d3d2 |
Files: src/buffer.c
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
*** ../vim-7.3.647/src/buffer.c 2012-07-16 17:31:48.000000000 +0200
|
|
Karsten Hopp |
80d3d2 |
--- src/buffer.c 2012-09-05 13:17:38.000000000 +0200
|
|
Karsten Hopp |
80d3d2 |
***************
|
|
Karsten Hopp |
80d3d2 |
*** 3234,3245 ****
|
|
Karsten Hopp |
80d3d2 |
{
|
|
Karsten Hopp |
80d3d2 |
/* format: "fname + (path) (1 of 2) - VIM" */
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
if (curbuf->b_fname == NULL)
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf, (char_u *)_("[No Name]"), IOSIZE - 100);
|
|
Karsten Hopp |
80d3d2 |
else
|
|
Karsten Hopp |
80d3d2 |
{
|
|
Karsten Hopp |
80d3d2 |
p = transstr(gettail(curbuf->b_fname));
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf, p, IOSIZE - 100);
|
|
Karsten Hopp |
80d3d2 |
vim_free(p);
|
|
Karsten Hopp |
80d3d2 |
}
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
--- 3234,3248 ----
|
|
Karsten Hopp |
80d3d2 |
{
|
|
Karsten Hopp |
80d3d2 |
/* format: "fname + (path) (1 of 2) - VIM" */
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
+ #define SPACE_FOR_FNAME (IOSIZE - 100)
|
|
Karsten Hopp |
80d3d2 |
+ #define SPACE_FOR_DIR (IOSIZE - 20)
|
|
Karsten Hopp |
80d3d2 |
+ #define SPACE_FOR_ARGNR (IOSIZE - 10) /* at least room for " - VIM" */
|
|
Karsten Hopp |
80d3d2 |
if (curbuf->b_fname == NULL)
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf, (char_u *)_("[No Name]"), SPACE_FOR_FNAME);
|
|
Karsten Hopp |
80d3d2 |
else
|
|
Karsten Hopp |
80d3d2 |
{
|
|
Karsten Hopp |
80d3d2 |
p = transstr(gettail(curbuf->b_fname));
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf, p, SPACE_FOR_FNAME);
|
|
Karsten Hopp |
80d3d2 |
vim_free(p);
|
|
Karsten Hopp |
80d3d2 |
}
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
***************
|
|
Karsten Hopp |
80d3d2 |
*** 3263,3269 ****
|
|
Karsten Hopp |
80d3d2 |
buf[off++] = ' ';
|
|
Karsten Hopp |
80d3d2 |
buf[off++] = '(';
|
|
Karsten Hopp |
80d3d2 |
home_replace(curbuf, curbuf->b_ffname,
|
|
Karsten Hopp |
80d3d2 |
! buf + off, IOSIZE - off, TRUE);
|
|
Karsten Hopp |
80d3d2 |
#ifdef BACKSLASH_IN_FILENAME
|
|
Karsten Hopp |
80d3d2 |
/* avoid "c:/name" to be reduced to "c" */
|
|
Karsten Hopp |
80d3d2 |
if (isalpha(buf[off]) && buf[off + 1] == ':')
|
|
Karsten Hopp |
80d3d2 |
--- 3266,3272 ----
|
|
Karsten Hopp |
80d3d2 |
buf[off++] = ' ';
|
|
Karsten Hopp |
80d3d2 |
buf[off++] = '(';
|
|
Karsten Hopp |
80d3d2 |
home_replace(curbuf, curbuf->b_ffname,
|
|
Karsten Hopp |
80d3d2 |
! buf + off, SPACE_FOR_DIR - off, TRUE);
|
|
Karsten Hopp |
80d3d2 |
#ifdef BACKSLASH_IN_FILENAME
|
|
Karsten Hopp |
80d3d2 |
/* avoid "c:/name" to be reduced to "c" */
|
|
Karsten Hopp |
80d3d2 |
if (isalpha(buf[off]) && buf[off + 1] == ':')
|
|
Karsten Hopp |
80d3d2 |
***************
|
|
Karsten Hopp |
80d3d2 |
*** 3274,3291 ****
|
|
Karsten Hopp |
80d3d2 |
if (p == buf + off)
|
|
Karsten Hopp |
80d3d2 |
/* must be a help buffer */
|
|
Karsten Hopp |
80d3d2 |
vim_strncpy(buf + off, (char_u *)_("help"),
|
|
Karsten Hopp |
80d3d2 |
! (size_t)(IOSIZE - off - 1));
|
|
Karsten Hopp |
80d3d2 |
else
|
|
Karsten Hopp |
80d3d2 |
*p = NUL;
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
! /* translate unprintable chars */
|
|
Karsten Hopp |
80d3d2 |
! p = transstr(buf + off);
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf + off, p, (size_t)(IOSIZE - off - 1));
|
|
Karsten Hopp |
80d3d2 |
! vim_free(p);
|
|
Karsten Hopp |
80d3d2 |
STRCAT(buf, ")");
|
|
Karsten Hopp |
80d3d2 |
}
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
! append_arg_number(curwin, buf, IOSIZE, FALSE);
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
#if defined(FEAT_CLIENTSERVER)
|
|
Karsten Hopp |
80d3d2 |
if (serverName != NULL)
|
|
Karsten Hopp |
80d3d2 |
--- 3277,3304 ----
|
|
Karsten Hopp |
80d3d2 |
if (p == buf + off)
|
|
Karsten Hopp |
80d3d2 |
/* must be a help buffer */
|
|
Karsten Hopp |
80d3d2 |
vim_strncpy(buf + off, (char_u *)_("help"),
|
|
Karsten Hopp |
80d3d2 |
! (size_t)(SPACE_FOR_DIR - off - 1));
|
|
Karsten Hopp |
80d3d2 |
else
|
|
Karsten Hopp |
80d3d2 |
*p = NUL;
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
! /* Translate unprintable chars and concatenate. Keep some
|
|
Karsten Hopp |
80d3d2 |
! * room for the server name. When there is no room (very long
|
|
Karsten Hopp |
80d3d2 |
! * file name) use (...). */
|
|
Karsten Hopp |
80d3d2 |
! if (off < SPACE_FOR_DIR)
|
|
Karsten Hopp |
80d3d2 |
! {
|
|
Karsten Hopp |
80d3d2 |
! p = transstr(buf + off);
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf + off, p, (size_t)(SPACE_FOR_DIR - off));
|
|
Karsten Hopp |
80d3d2 |
! vim_free(p);
|
|
Karsten Hopp |
80d3d2 |
! }
|
|
Karsten Hopp |
80d3d2 |
! else
|
|
Karsten Hopp |
80d3d2 |
! {
|
|
Karsten Hopp |
80d3d2 |
! vim_strncpy(buf + off, (char_u *)"...",
|
|
Karsten Hopp |
80d3d2 |
! (size_t)(SPACE_FOR_ARGNR - off));
|
|
Karsten Hopp |
80d3d2 |
! }
|
|
Karsten Hopp |
80d3d2 |
STRCAT(buf, ")");
|
|
Karsten Hopp |
80d3d2 |
}
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
! append_arg_number(curwin, buf, SPACE_FOR_ARGNR, FALSE);
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
#if defined(FEAT_CLIENTSERVER)
|
|
Karsten Hopp |
80d3d2 |
if (serverName != NULL)
|
|
Karsten Hopp |
80d3d2 |
*** ../vim-7.3.647/src/version.c 2012-09-05 12:16:40.000000000 +0200
|
|
Karsten Hopp |
80d3d2 |
--- src/version.c 2012-09-05 13:29:53.000000000 +0200
|
|
Karsten Hopp |
80d3d2 |
***************
|
|
Karsten Hopp |
80d3d2 |
*** 721,722 ****
|
|
Karsten Hopp |
80d3d2 |
--- 721,724 ----
|
|
Karsten Hopp |
80d3d2 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
80d3d2 |
+ /**/
|
|
Karsten Hopp |
80d3d2 |
+ 648,
|
|
Karsten Hopp |
80d3d2 |
/**/
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
--
|
|
Karsten Hopp |
80d3d2 |
Q: How does a UNIX Guru do Sex ?
|
|
Karsten Hopp |
80d3d2 |
A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep
|
|
Karsten Hopp |
80d3d2 |
|
|
Karsten Hopp |
80d3d2 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
80d3d2 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
80d3d2 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
80d3d2 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|