home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 5.7.030 < prev    next >
Encoding:
Internet Message Format  |  2001-04-23  |  3.3 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.7.030
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.7.030
  8. Problem:    A ":make" or ":grep" command with a very long argument could cause
  9.         a crash.
  10. Solution:   Allocate the buffer for the shell command.
  11. Files:        src/ex_docmd.c
  12.  
  13.  
  14. *** ../vim-5.7.29/src/ex_docmd.c    Mon Jan 29 21:37:18 2001
  15. --- src/ex_docmd.c    Tue Apr 24 17:00:42 2001
  16. ***************
  17. *** 4059,4064 ****
  18. --- 4062,4069 ----
  19.       char_u *errorformat;
  20.   {
  21.       char_u    *name;
  22. +     char_u    *cmd;
  23. +     unsigned    len;
  24.   
  25.       autowrite_all();
  26.       name = get_mef_name(TRUE);
  27. ***************
  28. *** 4069,4078 ****
  29.       /*
  30.        * If 'shellpipe' empty: don't redirect to 'errorfile'.
  31.        */
  32.       if (*p_sp == NUL)
  33. !     sprintf((char *)IObuff, "%s%s%s", p_shq, arg, p_shq);
  34.       else
  35. !     sprintf((char *)IObuff, "%s%s%s %s %s", p_shq, arg, p_shq, p_sp, name);
  36.       /*
  37.        * Output a newline if there's something else than the :make command that
  38.        * was typed (in which case the cursor is in column 0).
  39. --- 4074,4089 ----
  40.       /*
  41.        * If 'shellpipe' empty: don't redirect to 'errorfile'.
  42.        */
  43. +     len = STRLEN(p_shq) * 2 + STRLEN(arg) + 1;
  44. +     if (*p_sp != NUL)
  45. +     len += STRLEN(p_sp) + STRLEN(name) + 2;
  46. +     cmd = alloc(len);
  47. +     if (cmd == NULL)
  48. +     return;
  49.       if (*p_sp == NUL)
  50. !     sprintf((char *)cmd, "%s%s%s", p_shq, arg, p_shq);
  51.       else
  52. !     sprintf((char *)cmd, "%s%s%s %s %s", p_shq, arg, p_shq, p_sp, name);
  53.       /*
  54.        * Output a newline if there's something else than the :make command that
  55.        * was typed (in which case the cursor is in column 0).
  56. ***************
  57. *** 4080,4089 ****
  58.       if (msg_col != 0)
  59.       msg_putchar('\n');
  60.       MSG_PUTS(":!");
  61. !     msg_outtrans(IObuff);        /* show what we are doing */
  62.   
  63.       /* let the shell know if we are redirecting output or not */
  64. !     do_shell(IObuff, *p_sp ? SHELL_DOOUT : 0);
  65.   
  66.   #ifdef AMIGA
  67.       out_flush();
  68. --- 4091,4100 ----
  69.       if (msg_col != 0)
  70.       msg_putchar('\n');
  71.       MSG_PUTS(":!");
  72. !     msg_outtrans(cmd);        /* show what we are doing */
  73.   
  74.       /* let the shell know if we are redirecting output or not */
  75. !     do_shell(cmd, *p_sp != NUL ? SHELL_DOOUT : 0);
  76.   
  77.   #ifdef AMIGA
  78.       out_flush();
  79. ***************
  80. *** 4096,4101 ****
  81. --- 4107,4113 ----
  82.   
  83.       mch_remove(name);
  84.       vim_free(name);
  85. +     vim_free(cmd);
  86.   }
  87.   
  88.   /*
  89. *** ../vim-5.7.29/src/version.c    Tue Apr 24 10:30:03 2001
  90. --- src/version.c    Tue Apr 24 17:05:49 2001
  91. ***************
  92. *** 439,440 ****
  93. --- 439,442 ----
  94.   {   /* Add new patch number below this line */
  95. + /**/
  96. +     30,
  97.   /**/
  98.  
  99. -- 
  100. A poem:                read aloud:
  101.  
  102. <> !*''#               Waka waka bang splat tick tick hash,
  103. ^"`$$-                 Caret quote back-tick dollar dollar dash,
  104. !*=@$_                 Bang splat equal at dollar under-score,
  105. %*<> ~#4               Percent splat waka waka tilde number four,
  106. &[]../                 Ampersand bracket bracket dot dot slash,
  107. |{,,SYSTEM HALTED      Vertical-bar curly-bracket comma comma CRASH.
  108.  
  109. Fred Bremmer and Steve Kroese (Calvin College & Seminary of Grand Rapids, MI.)
  110.  
  111.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  112. (((   Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim   )))
  113.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  114.