Commits
Rainer Müller authored 71be901ce3c
1 + | To: vim_dev@googlegroups.com |
2 + | Subject: Patch 8.1.1365 |
3 + | Fcc: outbox |
4 + | From: Bram Moolenaar <Bram@moolenaar.net> |
5 + | Mime-Version: 1.0 |
6 + | Content-Type: text/plain; charset=UTF-8 |
7 + | Content-Transfer-Encoding: 8bit |
8 + | ------------ |
9 + | |
10 + | Patch 8.1.1365 |
11 + | Problem: Source command doesn't check for the sandbox. (Armin Razmjou) |
12 + | Solution: Check for the sandbox when sourcing a file. |
13 + | Files: src/getchar.c, src/testdir/test_source.vim |
14 + | |
15 + | |
16 + | *** ../vim-8.1.1364/src/getchar.c 2019-05-19 21:57:05.670320399 +0200 |
17 + | --- src/getchar.c 2019-05-22 20:33:44.175220749 +0200 |
18 + | *************** |
19 + | *** 1407,1412 **** |
20 + | --- 1407,1418 ---- |
21 + | emsg(_(e_nesting)); |
22 + | return; |
23 + | } |
24 + | + |
25 + | + // Disallow sourcing a file in the sandbox, the commands would be executed |
26 + | + // later, possibly outside of the sandbox. |
27 + | + if (check_secure()) |
28 + | + return; |
29 + | + |
30 + | #ifdef FEAT_EVAL |
31 + | if (ignore_script) |
32 + | /* Not reading from script, also don't open one. Warning message? */ |
33 + | *** ../vim-8.1.1364/src/testdir/test_source.vim 2019-01-12 13:25:42.633479785 +0100 |
34 + | --- src/testdir/test_source.vim 2019-05-22 20:44:58.887015783 +0200 |
35 + | *************** |
36 + | *** 36,38 **** |
37 + | --- 36,47 ---- |
38 + | au! SourcePre |
39 + | au! SourcePost |
40 + | endfunc |
41 + | + |
42 + | + func Test_source_sandbox() |
43 + | + new |
44 + | + call writefile(["Ohello\<Esc>"], 'Xsourcehello') |
45 + | + source! Xsourcehello | echo |
46 + | + call assert_equal('hello', getline(1)) |
47 + | + call assert_fails('sandbox source! Xsourcehello', 'E48:') |
48 + | + bwipe! |
49 + | + endfunc |
50 + | *** ../vim-8.1.1364/src/version.c 2019-05-21 23:08:56.969600854 +0200 |
51 + | --- src/version.c 2019-05-22 22:37:10.196825450 +0200 |
52 + | *************** |
53 + | *** 769,770 **** |
54 + | --- 769,772 ---- |
55 + | { /* Add new patch number below this line */ |
56 + | + /**/ |
57 + | + 1365, |
58 + | /**/ |
59 + | |
60 + | -- |
61 + | hundred-and-one symptoms of being an internet addict: |
62 + | 13. You refer to going to the bathroom as downloading. |
63 + | |
64 + | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
65 + | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
66 + | \\\ an exciting new programming language -- http://www.Zimbu.org /// |
67 + | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |