summaryrefslogtreecommitdiffstats
path: root/libiberty/testsuite
diff options
context:
space:
mode:
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-10 18:13:23 +0000
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-10 18:13:23 +0000
commit19bff7fe624209f0ffe8d6cac8a7a735e9c507f5 (patch)
tree84923574d7148244e7ef13407257998dade20efe /libiberty/testsuite
parent73d774f662ae0655364adaf29bb09180821abc03 (diff)
downloadppe42-gcc-19bff7fe624209f0ffe8d6cac8a7a735e9c507f5.tar.gz
ppe42-gcc-19bff7fe624209f0ffe8d6cac8a7a735e9c507f5.zip
2011-04-10 Jim Meyering <meyering@redhat.com>
Avoid memory overrun in a test leading to potential double-free. * testsuite/test-expandargv.c (writeout_test): Fix off-by-one error: i.e., do copy the trailing NUL byte. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172246 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/testsuite')
-rw-r--r--libiberty/testsuite/test-expandargv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c
index c16a0322a6c..57b96b3ff97 100644
--- a/libiberty/testsuite/test-expandargv.c
+++ b/libiberty/testsuite/test-expandargv.c
@@ -204,7 +204,7 @@ writeout_test (int test, const char * test_data)
if (parse == NULL)
fatal_error (__LINE__, "Failed to malloc parse.", errno);
- memcpy (parse, test_data, sizeof (char) * len);
+ memcpy (parse, test_data, sizeof (char) * (len + 1));
/* Run all possible replaces */
run_replaces (parse);
OpenPOWER on IntegriCloud