This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix for off-by-one error in cpplib
- To: gcc-patches at gcc dot gnu dot org
- Subject: Fix for off-by-one error in cpplib
- From: Andreas Jaeger <aj at suse dot de>
- Date: 13 Mar 2000 17:28:23 +0100
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>
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