grammar tool bug

There is a bug in `Amaya/batch/grammar.c' on
lines 870 and 871. These lines read as follows:

869                  /* cree le fichier .LST */
870                  listFile = fopen (fileName, "w");
871                  fprintf (listFile, "GRAMMAR OF
FILE ");
872                  i = 0;
873                  while (fileName[i] != '.')
874                    putc (fileName[i++], listFile);

The return value from `fopen()' is not checked
for failure. If the user doesn't have permission
to write the to list file, `fopen()' will fail
(returning null).

On my system (LINUX-ELF), the call to `fprintf()'
on line 871 doesn't produce a segfault for some
reason, but the segfault does occur on line 874 --
when `putc()' is called.

The return values for `fopen' and `malloc' should
*always* be checked for possible failure.

I discovered this problem when trying to compile
Amaya as a different user from the user that
checked out the working directory.

Another (related) problem, is that, even if you
build Amaya in a directory that is different from the
working directory, the build process wants to write
into the working directory anyway.



__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Received on Saturday, 1 July 2000 06:02:39 UTC