]> granicus.if.org Git - vim/commitdiff
patch 8.0.0887: can create a logfile in the sandbox v8.0.0887
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Aug 2017 18:51:51 +0000 (20:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Aug 2017 18:51:51 +0000 (20:51 +0200)
Problem:    Can create a logfile in the sandbox.
Solution:   Disable ch_logfile() in the sandbox. (Yasuhiro Matsumoto)

src/evalfunc.c
src/version.c

index 2377d1957efd3afa1aeac9106a42caf8d14e491e..0703b44f1945960b469616968940294e853b4631 100644 (file)
@@ -1930,6 +1930,9 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED)
     char_u *opt = (char_u *)"";
     char_u buf[NUMBUFLEN];
 
+    /* Don't open a file in restricted mode. */
+    if (check_restricted() || check_secure())
+       return;
     fname = get_tv_string(&argvars[0]);
     if (argvars[1].v_type == VAR_STRING)
        opt = get_tv_string_buf(&argvars[1], buf);
index 4e78e31a2e4a8e77608e48f791c44ca4a40db96e..29703ed717cdaae85dbbdaf8995d1cba06d2d91b 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    887,
 /**/
     886,
 /**/