patch 9.2.0404: redraw_listener_add() does not check secure flag

Commit: 
https://github.com/vim/vim/commit/3958188f6aace8f828a36f8886e99c6a64fedcf1
Author: Christian Brabandt <[email protected]>
Date:   Mon Apr 27 18:29:33 2026 +0000

    patch 9.2.0404: redraw_listener_add() does not check secure flag
    
    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 <[email protected]>

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 371de4b2c..67ebc70f9 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -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|
 
 
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 2f36f4f5a..702d686ab 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -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));
diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim
index 8cbd15377..6b91e8d04 100644
--- a/src/testdir/test_listener.vim
+++ b/src/testdir/test_listener.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 72f88365f..ef0fd8afa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    404,
 /**/
     403,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1wHQx5-004O0d-QX%40256bit.org.

Raspunde prin e-mail lui