diff options
author | DJ Delorie <dj@redhat.com> | 2011-04-10 19:15:10 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2011-04-10 19:15:10 +0000 |
commit | a55c6f410e2441300484d94d790d7f265c7991b6 (patch) | |
tree | 104e2d61d76f51a50fd19b98d3ba96686b61e11f | |
parent | e2ece73c64432d4c43522de5d1a633ca12cc9155 (diff) | |
download | gdb-a55c6f410e2441300484d94d790d7f265c7991b6.zip gdb-a55c6f410e2441300484d94d790d7f265c7991b6.tar.gz gdb-a55c6f410e2441300484d94d790d7f265c7991b6.tar.bz2 |
merge from gcc
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/testsuite/test-expandargv.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index f6138b6..a15ffa5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +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. + 2011-03-31 Tristan Gingold <gingold@adacore.com> * makefile.vms (OBJS): Add filename_cmp.obj 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); |