From: Ian Lance Taylor Date: Wed, 30 Apr 2014 02:38:30 +0000 (+0000) Subject: compiler: Don't overwrite memory if an archive has a bad file name. X-Git-Tag: releases/gcc-5.1.0~7856 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=171f2e787d4bc1d644acbede5eaf7641ff6a18d6;p=thirdparty%2Fgcc.git compiler: Don't overwrite memory if an archive has a bad file name. From-SVN: r209924 --- diff --git a/gcc/go/gofrontend/import-archive.cc b/gcc/go/gofrontend/import-archive.cc index 9a1d5b3d7ef6..34fb528ab5c6 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';