blob: 454ccaef3ba358590ac564cb0fe501801cb5da41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
commit 23a979dc1779ac63cd799bfa2f6c2aed1f1bff66
Author: Francois Gouget <fgouget@codeweavers.com>
Date: Tue Dec 20 18:41:35 2011 +0100
bfd: Fix parsing the size of archive elements larger than 2GB.
diff --git a/bfd/archive.c b/bfd/archive.c
index 05aba6c..01acf98 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -446,7 +446,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
{
struct ar_hdr hdr;
char *hdrp = (char *) &hdr;
- size_t parsed_size;
+ bfd_size_type parsed_size;
struct areltdata *ared;
char *filename = NULL;
bfd_size_type namelen = 0;
@@ -470,8 +470,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
}
errno = 0;
- parsed_size = strtol (hdr.ar_size, NULL, 10);
- if (errno != 0)
+ if (sscanf(hdr.ar_size, "%" BFD_VMA_FMT "u", &parsed_size) != 1)
{
bfd_set_error (bfd_error_malformed_archive);
return NULL;
|