diff src/ex_docmd.c @ 15748:93b78c4a7cd5 v8.1.0881

patch 8.1.0881: can execute shell commands in rvim through interfaces commit https://github.com/vim/vim/commit/8c62a08faf89663e5633dc5036cd8695c80f1075 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 8 14:34:10 2019 +0100 patch 8.1.0881: can execute shell commands in rvim through interfaces Problem: Can execute shell commands in rvim through interfaces. Solution: Disable using interfaces in restricted mode. Allow for writing file with writefile(), histadd() and a few others.
author Bram Moolenaar <Bram@vim.org>
date Fri, 08 Feb 2019 14:45:07 +0100
parents ad8b2c109b22
children 6ddcd10aa7af
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2007,11 +2007,16 @@ do_one_cmd(
 #ifdef HAVE_SANDBOX
 	if (sandbox != 0 && !(ea.argt & SBOXOK))
 	{
-	    /* Command not allowed in sandbox. */
+	    // Command not allowed in sandbox.
 	    errormsg = _(e_sandbox);
 	    goto doend;
 	}
 #endif
+	if (restricted != 0 && (ea.argt & RESTRICT))
+	{
+	    errormsg = _("E981: Command not allowed in rvim");
+	    goto doend;
+	}
 	if (!curbuf->b_p_ma && (ea.argt & MODIFY))
 	{
 	    /* Command not allowed in non-'modifiable' buffer */