diff options
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-15996.patch')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils/CVE-2017-15996.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-15996.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-15996.patch new file mode 100644 index 0000000000..dab8380e33 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-15996.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From d91f0b20e561e326ee91a09a76206257bde8438b Mon Sep 17 00:00:00 2001 | ||
2 | From: Alan Modra <amodra@gmail.com> | ||
3 | Date: Sat, 28 Oct 2017 21:31:16 +1030 | ||
4 | Subject: [PATCH] PR22361 readelf buffer overflow on fuzzed archive header | ||
5 | |||
6 | PR 22361 | ||
7 | * readelf.c (process_archive_index_and_symbols): Ensure ar_size | ||
8 | field is zero terminated for strtoul. | ||
9 | (setup_archive, get_archive_member_name): Likewise. | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | Affects: <= 2.29.1 | ||
13 | CVE: CVE-2017-15996 | ||
14 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
15 | |||
16 | --- | ||
17 | binutils/ChangeLog | 7 +++++++ | ||
18 | binutils/elfcomm.c | 11 +++++++++++ | ||
19 | 2 files changed, 18 insertions(+) | ||
20 | |||
21 | Index: git/binutils/elfcomm.c | ||
22 | =================================================================== | ||
23 | --- git.orig/binutils/elfcomm.c | ||
24 | +++ git/binutils/elfcomm.c | ||
25 | @@ -466,8 +466,12 @@ process_archive_index_and_symbols (struc | ||
26 | { | ||
27 | size_t got; | ||
28 | unsigned long size; | ||
29 | + char fmag_save; | ||
30 | |||
31 | + fmag_save = arch->arhdr.ar_fmag[0]; | ||
32 | + arch->arhdr.ar_fmag[0] = 0; | ||
33 | size = strtoul (arch->arhdr.ar_size, NULL, 10); | ||
34 | + arch->arhdr.ar_fmag[0] = fmag_save; | ||
35 | /* PR 17531: file: 912bd7de. */ | ||
36 | if ((signed long) size < 0) | ||
37 | { | ||
38 | @@ -655,7 +659,10 @@ setup_archive (struct archive_info *arch | ||
39 | if (const_strneq (arch->arhdr.ar_name, "// ")) | ||
40 | { | ||
41 | /* This is the archive string table holding long member names. */ | ||
42 | + char fmag_save = arch->arhdr.ar_fmag[0]; | ||
43 | + arch->arhdr.ar_fmag[0] = 0; | ||
44 | arch->longnames_size = strtoul (arch->arhdr.ar_size, NULL, 10); | ||
45 | + arch->arhdr.ar_fmag[0] = fmag_save; | ||
46 | /* PR 17531: file: 01068045. */ | ||
47 | if (arch->longnames_size < 8) | ||
48 | { | ||
49 | @@ -758,6 +765,7 @@ get_archive_member_name (struct archive_ | ||
50 | char *endp; | ||
51 | char *member_file_name; | ||
52 | char *member_name; | ||
53 | + char fmag_save; | ||
54 | |||
55 | if (arch->longnames == NULL || arch->longnames_size == 0) | ||
56 | { | ||
57 | @@ -766,9 +774,12 @@ get_archive_member_name (struct archive_ | ||
58 | } | ||
59 | |||
60 | arch->nested_member_origin = 0; | ||
61 | + fmag_save = arch->arhdr.ar_fmag[0]; | ||
62 | + arch->arhdr.ar_fmag[0] = 0; | ||
63 | k = j = strtoul (arch->arhdr.ar_name + 1, &endp, 10); | ||
64 | if (arch->is_thin_archive && endp != NULL && * endp == ':') | ||
65 | arch->nested_member_origin = strtoul (endp + 1, NULL, 10); | ||
66 | + arch->arhdr.ar_fmag[0] = fmag_save; | ||
67 | |||
68 | if (j > arch->longnames_size) | ||
69 | { | ||
70 | Index: git/bfd/ChangeLog | ||
71 | =================================================================== | ||
72 | --- git.orig/bfd/ChangeLog | ||
73 | +++ git/bfd/ChangeLog | ||
74 | @@ -1,3 +1,10 @@ | ||
75 | +2017-10-28 Alan Modra <amodra@gmail.com> | ||
76 | + | ||
77 | + PR 22361 | ||
78 | + * readelf.c (process_archive_index_and_symbols): Ensure ar_size | ||
79 | + field is zero terminated for strtoul. | ||
80 | + (setup_archive, get_archive_member_name): Likewise. | ||
81 | + | ||
82 | 2017-09-26 Alan Modra <amodra@gmail.com> | ||
83 | |||
84 | PR 22205 | ||