mirror of
https://github.com/vim/vim.git
synced 2026-06-10 15:37:26 +02:00
patch 9.2.0608: popup_setoptions()/ch_setoptions() does not check secure mode
Problem: popup_setoptions()/ch_setoptions() does not check
secure/restricted mode
Solution: Add missing checks for check_restricted()/check_secure()
closes: #20456
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -5927,6 +5927,9 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
channel_T *channel;
|
||||
jobopt_T opt;
|
||||
|
||||
if (check_restricted() || check_secure())
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_chan_or_job_arg(argvars, 0) == FAIL
|
||||
|| check_for_dict_arg(argvars, 1) == FAIL))
|
||||
|
||||
@@ -4491,6 +4491,9 @@ f_popup_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
int need_redraw = FALSE;
|
||||
int need_reposition = FALSE;
|
||||
|
||||
if (check_secure())
|
||||
return;
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_number_arg(argvars, 0) == FAIL
|
||||
|| check_for_dict_arg(argvars, 1) == FAIL))
|
||||
|
||||
@@ -2632,8 +2632,9 @@ func Test_popup_opacity_move_after_close()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_popup_create_sandbox()
|
||||
func Test_popup_sandbox()
|
||||
call assert_fails('sandbox call popup_create("hello", {})', 'E48:')
|
||||
call assert_fails('sandbox call popup_setoptions(1, {})', 'E48:')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -70,6 +70,7 @@ func Test_restricted_mode()
|
||||
if has('channel')
|
||||
call assert_fails("call ch_logfile('Xlog')", 'E145:')
|
||||
call assert_fails("call ch_open('localhost:8765')", 'E145:')
|
||||
call assert_fails("call ch_setoptions('localhost:8765', {})", 'E145:')
|
||||
endif
|
||||
|
||||
if has('job')
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
608,
|
||||
/**/
|
||||
607,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user