]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0404: redraw_listener_add() does not check secure flag v9.2.0404
authorChristian Brabandt <cb@256bit.org>
Mon, 27 Apr 2026 18:29:33 +0000 (18:29 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 27 Apr 2026 18:34:01 +0000 (18:34 +0000)
Problem:  redraw_listener_add() does not check secure flag
Solution: Check for check_secure() in f_redraw_listener_add()

closes: #20070

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/builtin.txt
src/drawscreen.c
src/testdir/test_listener.vim
src/version.c

index 371de4b2c68a1df150e69503566953771f6cca31..67ebc70f94ffc9d2c671880398dec78da5f60f63 100644 (file)
@@ -1,4 +1,4 @@
-*builtin.txt*  For Vim version 9.2.  Last change: 2026 Apr 26
+*builtin.txt*  For Vim version 9.2.  Last change: 2026 Apr 27
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -6863,6 +6863,8 @@ listener_add({callback} [, {buf} [, {unbuffered}]])       *listener_add()*
                second argument: >
                        GetBuffer()->listener_add(callback)
 <
+               This function is not available in the |sandbox|.
+
                Return type: |Number|
 
 
@@ -6877,6 +6879,8 @@ listener_flush([{buf}])                                   *listener_flush()*
                Can also be used as a |method|: >
                        GetBuffer()->listener_flush()
 <
+               This function is not available in the |sandbox|.
+
                Return type: void
 
 
@@ -6888,6 +6892,8 @@ listener_remove({id})                                     *listener_remove()*
                Can also be used as a |method|: >
                        GetListenerId()->listener_remove()
 <
+               This function is not available in the |sandbox|.
+
                Return type: |Number|
 
 
@@ -8867,6 +8873,8 @@ redraw_listener_add({opts})                               *redraw_listener_add()*
                Can also be used as a |method|: >
                        GetOpts()->redraw_listener_add()
 <
+               This function is not available in the |sandbox|.
+
                Return type: |Number|
 
 
index 2f36f4f5a0e5c7281f7f3860ae67839b007f9c2a..702d686abaedfb118b9282a2ce75555c65a7e9cf 100644 (file)
@@ -3506,6 +3506,9 @@ f_redraw_listener_add(typval_T *argvars, typval_T *rettv)
     bool               got_one = false;
     static int         id;
 
+    if (check_secure())
+       return;
+
     if (redraw_cb_in_progress)
     {
        emsg(_(e_cannot_add_redraw_listener_in_listener_callback));
index 8cbd15377a4176b0b24458ebdd8cc9cd36a278cf..6b91e8d0460de216c4b60bce498b459fe7ee19f1 100644 (file)
@@ -801,4 +801,15 @@ func Test_listener_blockwise_paste()
   bwipe!
 endfunc
 
+func Test_listener_add_in_sandbox()
+  call assert_fails(
+    \ 'sandbox call redraw_listener_add({"on_start": function("tr")})',
+    \ 'E48:')
+  call assert_fails(
+    \ 'sandbox call listener_add({"on_start": function("tr")})',
+    \ 'E48:')
+  call assert_fails('sandbox call listener_flush()', 'E48:')
+  call assert_fails('sandbox call listener_remove(1)', 'E48:')
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 72f88365f5b900622fd26a21ffc666f3b01fb4a3..ef0fd8afa25dddb8714ba78927971ccac87b247c 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    404,
 /**/
     403,
 /**/