compiler: Don't overwrite memory if an archive has a bad file name.

From-SVN: r209924
This commit is contained in:
Ian Lance Taylor 2014-04-30 02:38:30 +00:00
parent f66d6bec5e
commit 171f2e787d
1 changed files with 1 additions and 1 deletions

View File

@ -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';