diff options
author | Jim Meyering <meyering@redhat.com> | 2011-04-10 18:13:23 +0000 |
---|---|---|
committer | Mike Stump <mrs@gcc.gnu.org> | 2011-04-10 18:13:23 +0000 |
commit | 4b9726d48cc7eea7e51b51e00e3720104cd2774f (patch) | |
tree | 84923574d7148244e7ef13407257998dade20efe /libiberty/testsuite | |
parent | 5b2d2d52fe20551875570ae70eedc99914981d37 (diff) | |
download | gcc-4b9726d48cc7eea7e51b51e00e3720104cd2774f.zip gcc-4b9726d48cc7eea7e51b51e00e3720104cd2774f.tar.gz gcc-4b9726d48cc7eea7e51b51e00e3720104cd2774f.tar.bz2 |
Avoid memory overrun in a test leading to potential double-free.
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.
From-SVN: r172246
Diffstat (limited to 'libiberty/testsuite')
-rw-r--r-- | libiberty/testsuite/test-expandargv.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libiberty/testsuite/test-expandargv.c b/libiberty/testsuite/test-expandargv.c index c16a032..57b96b3 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); |