This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Fix butter overrun


Patch below fixes a buffer overrun when parsing commandline options.

Paul

2004-05-16  Paul Brook  <paul@codesourcery.com>

	* options.c (gfc_handle_module_path_options): Fix buffer overrun.

Index: options.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/options.c,v
retrieving revision 1.3
diff -u -p -r1.3 options.c
--- a/options.c	14 May 2004 13:00:04 -0000	1.3
+++ b/options.c	16 May 2004 21:04:30 -0000
@@ -155,7 +155,7 @@ gfc_handle_module_path_options (const ch
       exit (3);
     }
 
-  gfc_option.module_dir = (char *) gfc_getmem (strlen (arg));
+  gfc_option.module_dir = (char *) gfc_getmem (strlen (arg) + 2);
   strcpy (gfc_option.module_dir, arg);
   strcat (gfc_option.module_dir, "/");
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]