Here's how to stop shell escapes from vi

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Sep 21 08:15:20 AEST 1990


In article <1990Sep20.153105.28394 at naitc.naitc.com> karl at bbs.naitc.com (Karl Denninger) writes:
> Without source code to "vi" there is NO WAY to prevent this.  Believe me.  

How fatalistic.

It's easy to prevent shell escapes from vi. All you have to do is make
sure that the : and ! characters aren't accessible from command mode.
This takes one command:

  % pty -0 tr \:\! \?\? | pty vi

Of course, you should have keyboard signal characters turned off. And
you need to pick up a copy of pty, which hasn't yet been ported to
System V. Under BSD, though, you don't need to do any coding work.

A more polite solution is to convert : into <esc>a:, and convert ! into
<esc>a!. In any case you should provide macros to exercise a limited
subset of the functions of : and !---to let the user :set nu or nonu,
for example.

Can we stop discussing this problem now? It's solved.

---Dan



More information about the Comp.unix.sysv386 mailing list