Ghost file

DAVID NEWALL ccdn at levels.sait.edu.au
Fri Nov 25 22:11:13 AEST 1988


I had an off by one bug in a "high level" file access library, once.  It's
effect was to append a single character (usually > 127) to the end of all
files created.  Needless to say, I couldn't generate the filename from
within the shell, and so I couldn't delete it using rm.

But it turned out to be easy, to write a C program to delete the file.  It
looked sort of like this:

main()
{
   char name[] = "badfile?";
   name[7] = (char) 255;
   unlink(name);
}

Of course, I had to use "od" to find out the value of the `bad' character.
(Ls, by default, displays unprintable characters as "?").

--

David Newall                     Phone:  +61 8 343 3160
Unix Systems Programmer          Fax:    +61 8 349 6939
Academic Computing Service       E-mail: ccdn at levels.sait.oz.au
SA Institute of Technology       Post:   The Levels, South Australia, 5095



More information about the Comp.unix.wizards mailing list