This is the mail archive of the gcc-cvs@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]

r243030 - in /trunk: gcc/ChangeLog gcc/selftest...


Author: dmalcolm
Date: Wed Nov 30 14:50:43 2016
New Revision: 243030

URL: https://gcc.gnu.org/viewcvs?rev=243030&root=gcc&view=rev
Log:
libiberty: avoid reading past end of buffer in strndup/xstrndup (PR c/78498)

gcc/ChangeLog:
	PR c/78498
	* selftest.c (selftest::assert_strndup_eq): New function.
	(selftest::test_strndup): New function.
	(selftest::test_libiberty): New function.
	(selftest::selftest_c_tests): Call test_libiberty.

gcc/testsuite/ChangeLog:
	PR c/78498
	* gcc.dg/format/pr78494.c: New test case.

libiberty/ChangeLog:
	PR c/78498
	* strndup.c (strlen): Delete decl.
	(strnlen): Add decl.
	(strndup): Call strnlen rather than strlen.
	* xstrndup.c (xstrndup): Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/format/pr78494.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/selftest.c
    trunk/gcc/testsuite/ChangeLog
    trunk/libiberty/ChangeLog
    trunk/libiberty/strndup.c
    trunk/libiberty/xstrndup.c


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