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 / 6.1.265 < prev    next >
Encoding:
Internet Message Format  |  2002-12-22  |  5.6 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.265
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.265
  11. Problem:    libcall() can be used in 'foldexpr' to call any system function.
  12.         rename(), delete() and remote_send() can also be used in
  13.         'foldexpr'.  These are security problems. (Georgi Guninski)
  14. Solution:   Don't allow using libcall(), rename(), delete(), remote_send() and
  15.         similar functions in the sandbox.
  16. Files:        src/eval.c
  17.  
  18.  
  19. *** ../vim61.264/src/eval.c    Sun Dec 22 11:22:09 2002
  20. --- src/eval.c    Mon Dec 23 21:19:45 2002
  21. ***************
  22. *** 3346,3351 ****
  23. --- 3346,3354 ----
  24.       else
  25.       retvar->var_val.var_string = NULL;
  26.   
  27. +     if (check_restricted() || check_secure())
  28. +     return;
  29.   #ifdef FEAT_LIBCALL
  30.       /* The first two args must be strings, otherwise its meaningless */
  31.       if (argvars[0].var_type == VAR_STRING && argvars[1].var_type == VAR_STRING)
  32. ***************
  33. *** 3378,3384 ****
  34.       VAR        argvars;
  35.       VAR        retvar;
  36.   {
  37. !     retvar->var_val.var_number = mch_remove(get_var_string(&argvars[0]));
  38.   }
  39.   
  40.   /*
  41. --- 3381,3390 ----
  42.       VAR        argvars;
  43.       VAR        retvar;
  44.   {
  45. !     if (check_restricted() || check_secure())
  46. !     retvar->var_val.var_number = -1;
  47. !     else
  48. !     retvar->var_val.var_number = mch_remove(get_var_string(&argvars[0]));
  49.   }
  50.   
  51.   /*
  52. ***************
  53. *** 4625,4631 ****
  54. --- 4631,4642 ----
  55.       int        histype;
  56.       char_u    *str;
  57.       char_u    buf[NUMBUFLEN];
  58. + #endif
  59.   
  60. +     retvar->var_val.var_number = FALSE;
  61. +     if (check_restricted() || check_secure())
  62. +     return;
  63. + #ifdef FEAT_CMDHIST
  64.       histype = get_histtype(get_var_string(&argvars[0]));
  65.       if (histype >= 0)
  66.       {
  67. ***************
  68. *** 4638,4644 ****
  69.       }
  70.       }
  71.   #endif
  72. -     retvar->var_val.var_number = FALSE;
  73.   }
  74.   
  75.   /*
  76. --- 4649,4654 ----
  77. ***************
  78. *** 5267,5273 ****
  79.   {
  80.       char_u    buf[NUMBUFLEN];
  81.   
  82. !     retvar->var_val.var_number = vim_rename(get_var_string(&argvars[0]),
  83.                       get_var_string_buf(&argvars[1], buf));
  84.   }
  85.   
  86. --- 5277,5286 ----
  87.   {
  88.       char_u    buf[NUMBUFLEN];
  89.   
  90. !     if (check_restricted() || check_secure())
  91. !     retvar->var_val.var_number = -1;
  92. !     else
  93. !     retvar->var_val.var_number = vim_rename(get_var_string(&argvars[0]),
  94.                       get_var_string_buf(&argvars[1], buf));
  95.   }
  96.   
  97. ***************
  98. *** 5547,5552 ****
  99. --- 5560,5567 ----
  100.       VAR        varp;
  101.       char_u    nbuf[NUMBUFLEN];
  102.   
  103. +     if (check_restricted() || check_secure())
  104. +     return;
  105.       ++emsg_off;
  106.       buf = get_buf_var(&argvars[0]);
  107.       varname = get_var_string(&argvars[1]);
  108. ***************
  109. *** 5633,5638 ****
  110. --- 5648,5655 ----
  111.       VAR        varp;
  112.       char_u    nbuf[NUMBUFLEN];
  113.   
  114. +     if (check_restricted() || check_secure())
  115. +     return;
  116.       ++emsg_off;
  117.       win = find_win_by_nr(&argvars[0]);
  118.       varname = get_var_string(&argvars[1]);
  119. ***************
  120. *** 5765,5770 ****
  121. --- 5782,5792 ----
  122.       var        v;
  123.       char_u    *s;
  124.   
  125. +     if (check_restricted() || check_secure())
  126. +     {
  127. +     retvar->var_val.var_number = -1;
  128. +     return;
  129. +     }
  130.   # ifdef WIN32
  131.       int        n = 0;
  132.   
  133. ***************
  134. *** 5805,5824 ****
  135.       char_u    *r = NULL;
  136.   
  137.   #ifdef FEAT_CLIENTSERVER
  138.   # ifdef WIN32
  139. !     /* The server's HWND is encoded in the 'id' parameter */
  140. !     int        n = 0;
  141.   
  142. !     sscanf(get_var_string(&argvars[0]), "%x", &n);
  143. !     if (n != 0)
  144. !     r = serverGetReply((HWND)n, FALSE, TRUE, TRUE);
  145. !     if (r == NULL)
  146.   # else
  147. !     if (check_connection() == FAIL
  148. !         || serverReadReply(X_DISPLAY,
  149.             serverStrToWin(get_var_string(&argvars[0])), &r, FALSE) < 0)
  150.   # endif
  151. !     EMSG(_("E277: Unable to read a server reply"));
  152.   #endif
  153.       retvar->var_type = VAR_STRING;
  154.       retvar->var_val.var_string = r;
  155. --- 5827,5848 ----
  156.       char_u    *r = NULL;
  157.   
  158.   #ifdef FEAT_CLIENTSERVER
  159. +     if (!check_restricted() && !check_secure())
  160. +     {
  161.   # ifdef WIN32
  162. !     /* The server's HWND is encoded in the 'id' parameter */
  163. !     int        n = 0;
  164.   
  165. !     sscanf(get_var_string(&argvars[0]), "%x", &n);
  166. !     if (n != 0)
  167. !         r = serverGetReply((HWND)n, FALSE, TRUE, TRUE);
  168. !     if (r == NULL)
  169.   # else
  170. !     if (check_connection() == FAIL || serverReadReply(X_DISPLAY,
  171.             serverStrToWin(get_var_string(&argvars[0])), &r, FALSE) < 0)
  172.   # endif
  173. !         EMSG(_("E277: Unable to read a server reply"));
  174. !     }
  175.   #endif
  176.       retvar->var_type = VAR_STRING;
  177.       retvar->var_val.var_string = r;
  178. ***************
  179. *** 5836,5842 ****
  180.       char_u    *reply = get_var_string_buf(&argvars[1], buf);
  181.   
  182.       retvar->var_val.var_number = -1;
  183. ! # ifndef WIN32
  184.       if (check_connection() == FAIL)
  185.       return;
  186.   # endif
  187. --- 5860,5868 ----
  188.       char_u    *reply = get_var_string_buf(&argvars[1], buf);
  189.   
  190.       retvar->var_val.var_number = -1;
  191. !     if (check_restricted() || check_secure())
  192. !     return;
  193. ! # ifdef FEAT_X11
  194.       if (check_connection() == FAIL)
  195.       return;
  196.   # endif
  197. ***************
  198. *** 5870,5875 ****
  199. --- 5896,5904 ----
  200.   # else
  201.       Window    w;
  202.   # endif
  203. +     if (check_restricted() || check_secure())
  204. +     return;
  205.   
  206.   # ifdef FEAT_X11
  207.       if (check_connection() == FAIL)
  208. *** ../vim61.264/src/version.c    Sun Dec 22 11:22:09 2002
  209. --- src/version.c    Mon Dec 23 21:14:33 2002
  210. ***************
  211. *** 608,609 ****
  212. --- 608,611 ----
  213.   {   /* Add new patch number below this line */
  214. + /**/
  215. +     265,
  216.   /**/
  217.  
  218. -- 
  219. Fingers not found - Pound head on keyboard to continue.
  220.  
  221.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  222. ///          Creator of Vim - Vi IMproved -- http://www.vim.org          \\\
  223. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  224.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  225.