fun bug in vi

Wayne Alston wja at iclbra.UUCP
Thu May 23 16:52:04 AEST 1985


An undocumented feature in vi allows a valid command in the file being 
'edited' of the form

	...ex:{command}:
or
	...vi:{command}:

to be actioned before interactive editing is allowed.  However, the bug also 
permits the variants ei and vx. The code reads:-

	if (beg[-2] != 'e' && beg[-2] != 'v') return;
	if (beg[-1] != 'x' && beg[-1] != 'i') return;

in routine checkmodeline().

The bug was discovered by trying to install a user with the initials 'jei' into
/etc/passwd.

Note that the above structure need not be at the beginning of the file.
Try vi'ing a file containing ei:x: .

Wayne Alston
..!reading!iclbra!wja



More information about the Net.bugs.usg mailing list