File 0016-CVE-2019-14194-CVE-2019-14198-nfs-f.patch of Package u-boot-odroid-c2.25181

From 87b9290fd153046b293782832aeadd2024c427d1 Mon Sep 17 00:00:00 2001
From: "liucheng (G)" <liucheng32@huawei.com>
Date: Thu, 29 Aug 2019 13:47:48 +0000
Subject: [PATCH] CVE-2019-14194/CVE-2019-14198: nfs: fix unbounded memcpy with
 a failed length check at nfs_read_reply
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch adds a check to rpc_pkt.u.reply.data at nfs_read_reply.

Signed-off-by: Cheng Liu <liucheng32@huawei.com>
Reported-by: Fermín Serna <fermin@semmle.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
(cherry picked from commit aa207cf3a6d68f39d64cd29057a4fb63943e9078)
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
---
 net/nfs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/nfs.c b/net/nfs.c
index f96e145259..b981104e9d 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -701,6 +701,9 @@ static int nfs_read_reply(uchar *pkt, unsigned len)
 			&(rpc_pkt.u.reply.data[4 + nfsv3_data_offset]);
 	}
 
+	if (((uchar *)&(rpc_pkt.u.reply.data[0]) - (uchar *)(&rpc_pkt) + rlen) > len)
+			return -9999;
+
 	if (store_block(data_ptr, nfs_offset, rlen))
 			return -9999;
 
openSUSE Build Service is sponsored by