[comp.bugs.misc] shar2

lai@vedge.UUCP (David Lai) (05/26/88)

In the recent posting of shar2, there is a minor bug which may cause
segmentation faults on some machines.  In the file shar2.c, in procedure
main, there is the statement:

while (argv[1][0] == '-')

is executed without checking to see if argc==1 (no args on the
command line), causing a dump.

The fix is to move the lines (which appear later in main):
    if (argc == 1)
    {
        fprintf (stderr, "%s: No input files\n", SHAR);
        helpuser ();
        exit (1);
    }

up to the top of main before while (argv[1][0] == '-')

-- 
	"What is a DJ if he can't scratch?"  - Uncle Jamms Army
The views expressed are those of the author, and not of Visual Edge, nor Usenet.
David Lai (vedge!lai@larry.mcrcim.mcgill.edu || ...watmath!onfcanim!vedge!lai)