Mercurial > vim
diff src/if_perl.xs @ 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 | dd725a8ab112 |
children | 7fad90423bd2 |
line wrap: on
line diff
--- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -971,6 +971,7 @@ VIM_init(void) #ifdef DYNAMIC_PERL static char *e_noperl = N_("Sorry, this command is disabled: the Perl library could not be loaded."); #endif +static char *e_perlsandbox = N_("E299: Perl evaluation forbidden in sandbox without the Safe module"); /* * ":perl" @@ -1019,13 +1020,12 @@ ex_perl(exarg_T *eap) vim_free(script); } -#ifdef HAVE_SANDBOX - if (sandbox) + if (sandbox || secure) { safe = perl_get_sv("VIM::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) - emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); + emsg(_(e_perlsandbox)); else # endif { @@ -1037,7 +1037,6 @@ ex_perl(exarg_T *eap) } } else -#endif perl_eval_sv(sv, G_DISCARD | G_NOARGS); SvREFCNT_dec(sv); @@ -1298,13 +1297,12 @@ do_perleval(char_u *str, typval_T *rettv ENTER; SAVETMPS; -#ifdef HAVE_SANDBOX - if (sandbox) + if (sandbox || secure) { safe = get_sv("VIM::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) - emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); + emsg(_(e_perlsandbox)); else # endif { @@ -1320,7 +1318,6 @@ do_perleval(char_u *str, typval_T *rettv } } else -#endif /* HAVE_SANDBOX */ sv = eval_pv((char *)str, 0); if (sv) {