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]

Fix for off-by-one error in cpplib



We're writting behind an allocated buffer in cpplib.c.  A patch is
appended.  Zack, this is a fix for your last patch ("convert cpplib to
use libiberty's hash tables").

Andreas

2000-03-13  Andreas Jaeger  <aj@suse.de>

	* cpplib.c (do_pragma_implementation): Fix off by one error.

Index: gcc/cpplib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.c,v
retrieving revision 1.131
diff -u -p -r1.131 cpplib.c
--- cpplib.c	2000/03/12 23:46:05	1.131
+++ cpplib.c	2000/03/13 16:23:48
@@ -1706,7 +1706,7 @@ do_pragma_implementation (pfile)
     }
 
   name = pfile->token_buffer + written + 1;
-  len = strlen (name);
+  len = strlen (name + 1);
   copy = (U_CHAR *) alloca (len);
   memcpy (copy, name, len - 1);
   copy[len] = '\0';	/* trim trailing quote */

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

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