diff options
author | Ian Lance Taylor <iant@google.com> | 2014-04-30 02:38:13 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2014-04-30 02:38:13 +0000 |
commit | dbd509e103b167feb9b92df2cb9d91881d3a3b3e (patch) | |
tree | d17a47598c00c8b301bf44e718420fdffa60430d /gcc/go | |
parent | 1ad1feaaa8c4d10de845fc5d6aadfd9968ca5638 (diff) |
compiler: Don't overwrite memory if an archive has a bad file name.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@209923 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/import-archive.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/import-archive.cc b/gcc/go/gofrontend/import-archive.cc index 9a1d5b3d7ef..34fb528ab5c 100644 --- a/gcc/go/gofrontend/import-archive.cc +++ b/gcc/go/gofrontend/import-archive.cc @@ -261,7 +261,7 @@ Archive_file::interpret_header(const Archive_header* hdr, off_t off, char size_string[size_string_size + 1]; memcpy(size_string, hdr->ar_size, size_string_size); char* ps = size_string + size_string_size; - while (ps[-1] == ' ') + while (ps > size_string && ps[-1] == ' ') --ps; *ps = '\0'; |