[Bug fortran/51090] libgfortran main.c missing NULL check on return value from getenv()

jb at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 11 11:07:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51090

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-11
                 CC|                            |jb at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jb at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #2 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-11-11 09:56:34 UTC ---
Confirmed.

As an aside, the proposed patch is incorrect; on line 153 n is used
uninitialized.

The simple fix is to put the 

if (!path)
  return;

directly following the getenv() call. libgfortran is C99 so we don't have to
declare everything up front. I'll do it and commit as obvious.



More information about the Gcc-bugs mailing list