[patch, fortran] Fix PR 32977

Thomas Koenig tkoenig@alice-dsl.net
Fri Aug 3 21:57:00 GMT 2007


:ADDPATCH fortran:

Hello world,

looks like vsnprintf wasn't available on every platform after all.
This patch fixes that by using a buffer that should be large enough,
and by issuing an error message in case of a buffer overflow.

Because the buffer is static, chances are pretty good that an overrun
won't clobber the other automatic variables in that routine.

Regression-tested on i686-pc-linux-gnu twice:

- with the #ifdef HAVE_VSNPRINTF replaced by #if 0 to check that
  codepath

- 'as is', to check the normal codepath

without any regressions.

OK for trunk?

	Thomas

2007-07-29  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR libfortran/32977
	* io/unix.c:  If there is no vsnprintf, use vsprintf and issue
	a fatal error when a buffer overrun occurs.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-vsprintf
Type: text/x-patch
Size: 1350 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070803/8bce879f/attachment.bin>


More information about the Fortran mailing list