aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-9954.patch
blob: 8a9d7ebd9f3e1acb51cd7a143e37569c4a4628b9 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 04e15b4a9462cb1ae819e878a6009829aab8020b Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 26 Jun 2017 15:46:34 +0100
Subject: [PATCH] Fix address violation parsing a corrupt texhex format file.

	PR binutils/21670
	* tekhex.c (getvalue): Check for the source pointer exceeding the
	end pointer before the first byte is read.

Upstream-Status: Backport
CVE: CVE_2017-9954
Signed-off-by: Armin Kuster <akuster@mvista.com>

---
 bfd/ChangeLog | 6 ++++++
 bfd/tekhex.c  | 6 +++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Index: git/bfd/tekhex.c
===================================================================
--- git.orig/bfd/tekhex.c
+++ git/bfd/tekhex.c
@@ -273,6 +273,9 @@ getvalue (char **srcp, bfd_vma *valuep,
   bfd_vma value = 0;
   unsigned int len;
 
+  if (src >= endp)
+    return FALSE;
+
   if (!ISHEX (*src))
     return FALSE;
 
@@ -514,9 +517,10 @@ pass_over (bfd *abfd, bfd_boolean (*func
   /* To the front of the file.  */
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
     return FALSE;
+
   while (! is_eof)
     {
-      char src[MAXCHUNK];
+      static char src[MAXCHUNK];
       char type;
 
       /* Find first '%'.  */
Index: git/bfd/ChangeLog
===================================================================
--- git.orig/bfd/ChangeLog
+++ git/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-26  Nick Clifton  <nickc@redhat.com>
+ 
+       PR binutils/21670
+       * tekhex.c (getvalue): Check for the source pointer exceeding the
+       end pointer before the first byte is read.
+
 2017-06-15  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21582