summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rsync/files/CVE-2016-9840.patch
diff options
context:
space:
mode:
authorAnuj Mittal <anuj.mittal@intel.com>2019-11-06 17:37:58 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-07 19:47:27 +0000
commit95d6d83772813f25afe1e48cb38fd47bbaaa0f96 (patch)
tree227bf781f0717e5e66dde369065c1b4a35f30515 /meta/recipes-devtools/rsync/files/CVE-2016-9840.patch
parent376ff1ce4c70054f2237a1bb55a32424d34d5488 (diff)
downloadpoky-95d6d83772813f25afe1e48cb38fd47bbaaa0f96.tar.gz
rsync: fix CVEs for included zlib
rsync includes its own copy of zlib and doesn't recommend linking with the system version [1]. Import CVE fixes that impact zlib version 1.2.8 [2] that is currently used by rsync. [1] https://git.samba.org/rsync.git/?p=rsync.git;a=blob;f=zlib/README.rsync [2] https://nvd.nist.gov/vuln/search/results?form_type=Advanced&cves=on&cpe_version=cpe%3a%2fa%3agnu%3azlib%3a1.2.8 (From OE-Core rev: a55fbb4cb489853dfb0b4553f6e187c3f3633f48) (From OE-Core rev: 1ce0a922853b6136a019763b64e58194bb0df00f) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Conflicts: meta/recipes-devtools/rsync/rsync_3.1.3.bb
Diffstat (limited to 'meta/recipes-devtools/rsync/files/CVE-2016-9840.patch')
-rw-r--r--meta/recipes-devtools/rsync/files/CVE-2016-9840.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rsync/files/CVE-2016-9840.patch b/meta/recipes-devtools/rsync/files/CVE-2016-9840.patch
new file mode 100644
index 0000000000..7581887790
--- /dev/null
+++ b/meta/recipes-devtools/rsync/files/CVE-2016-9840.patch
@@ -0,0 +1,75 @@
1From 6a043145ca6e9c55184013841a67b2fef87e44c0 Mon Sep 17 00:00:00 2001
2From: Mark Adler <madler@alumni.caltech.edu>
3Date: Wed, 21 Sep 2016 23:35:50 -0700
4Subject: [PATCH] Remove offset pointer optimization in inftrees.c.
5
6inftrees.c was subtracting an offset from a pointer to an array,
7in order to provide a pointer that allowed indexing starting at
8the offset. This is not compliant with the C standard, for which
9the behavior of a pointer decremented before its allocated memory
10is undefined. Per the recommendation of a security audit of the
11zlib code by Trail of Bits and TrustInSoft, in support of the
12Mozilla Foundation, this tiny optimization was removed, in order
13to avoid the possibility of undefined behavior.
14
15CVE: CVE-2016-9840
16Upstream-Status: Backport
17Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
18---
19 inftrees.c | 18 ++++++++----------
20 1 file changed, 8 insertions(+), 10 deletions(-)
21
22diff --git a/zlib/inftrees.c b/zlib/inftrees.c
23index 22fcd666..0d2670d5 100644
24--- a/zlib/inftrees.c
25+++ b/zlib/inftrees.c
26@@ -54,7 +54,7 @@ unsigned short FAR *work;
27 code FAR *next; /* next available space in table */
28 const unsigned short FAR *base; /* base value table to use */
29 const unsigned short FAR *extra; /* extra bits table to use */
30- int end; /* use base and extra for symbol > end */
31+ unsigned match; /* use base and extra for symbol >= match */
32 unsigned short count[MAXBITS+1]; /* number of codes of each length */
33 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
34 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
35@@ -181,19 +181,17 @@ unsigned short FAR *work;
36 switch (type) {
37 case CODES:
38 base = extra = work; /* dummy value--not used */
39- end = 19;
40+ match = 20;
41 break;
42 case LENS:
43 base = lbase;
44- base -= 257;
45 extra = lext;
46- extra -= 257;
47- end = 256;
48+ match = 257;
49 break;
50 default: /* DISTS */
51 base = dbase;
52 extra = dext;
53- end = -1;
54+ match = 0;
55 }
56
57 /* initialize state for loop */
58@@ -216,13 +214,13 @@ unsigned short FAR *work;
59 for (;;) {
60 /* create table entry */
61 here.bits = (unsigned char)(len - drop);
62- if ((int)(work[sym]) < end) {
63+ if (work[sym] + 1 < match) {
64 here.op = (unsigned char)0;
65 here.val = work[sym];
66 }
67- else if ((int)(work[sym]) > end) {
68- here.op = (unsigned char)(extra[work[sym]]);
69- here.val = base[work[sym]];
70+ else if (work[sym] >= match) {
71+ here.op = (unsigned char)(extra[work[sym] - match]);
72+ here.val = base[work[sym] - match];
73 }
74 else {
75 here.op = (unsigned char)(32 + 64); /* end of block */