]> code.ossystems Code Review - openembedded-core.git/blob
2261ea94b75d08ceb14adcb36dad315352a10f94
[openembedded-core.git] /
1 From 3c0d67184d6edb63f3b7d6d5eb81531daa6388f3 Mon Sep 17 00:00:00 2001
2 From: Changqing Li <changqing.li@windriver.com>
3 Date: Tue, 28 Aug 2018 16:25:36 +0800
4 Subject: [PATCH] squashfs-tools: patch for CVE-2015-4645(6)
5
6 Upstream-Status: Backport[https://github.com/devttys0/sasquatch/pull/
7                  5/commits/6777e08cc38bc780d27c69c1d8c272867b74524f]
8
9 CVE: CVE-2015-4645 CVE-2015-4646
10
11 Signed-off-by: Changqing Li <changqing.li@windriver.com>
12 ---
13  squashfs-tools/unsquash-4.c | 11 ++++++++---
14  1 file changed, 8 insertions(+), 3 deletions(-)
15
16 diff --git a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
17 index ecdaac7..692ae25 100644
18 --- a/squashfs-tools/unsquash-4.c
19 +++ b/squashfs-tools/unsquash-4.c
20 @@ -31,9 +31,9 @@ static unsigned int *id_table;
21  int read_fragment_table_4(long long *directory_table_end)
22  {
23         int res, i;
24 -       int bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments);
25 -       int  indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
26 -       long long fragment_table_index[indexes];
27 +       size_t bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments);
28 +       size_t indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
29 +       long long *fragment_table_index;
30  
31         TRACE("read_fragment_table: %d fragments, reading %d fragment indexes "
32                 "from 0x%llx\n", sBlk.s.fragments, indexes,
33 @@ -43,6 +43,11 @@ int read_fragment_table_4(long long *directory_table_end)
34                 *directory_table_end = sBlk.s.fragment_table_start;
35                 return TRUE;
36         }
37 +        
38 +       fragment_table_index = malloc(indexes*sizeof(long long));
39 +       if(fragment_table_index == NULL)
40 +               EXIT_UNSQUASH("read_fragment_table: failed to allocate "
41 +                       "fragment table index\n");
42  
43         fragment_table = malloc(bytes);
44         if(fragment_table == NULL)
45 -- 
46 2.7.4
47