From: liucheng (G) Date: Thu, 29 Aug 2019 13:47:54 +0000 (+0000) Subject: CVE-2019-14195: nfs: fix unbounded memcpy with unvalidated length at nfs_readlink_reply X-Git-Tag: v2019.10-rc4~22^2~4 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cf3a4f1e86ecdd24f87b615051b49d8e1968c230;p=oweals%2Fu-boot.git CVE-2019-14195: nfs: fix unbounded memcpy with unvalidated length at nfs_readlink_reply This patch adds a check to rpc_pkt.u.reply.data at nfs_readlink_reply. Signed-off-by: Cheng Liu Reported-by: Fermín Serna Acked-by: Joe Hershberger --- diff --git a/net/nfs.c b/net/nfs.c index 11941fad1a..915acd95cf 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -634,6 +634,9 @@ static int nfs_readlink_reply(uchar *pkt, unsigned len) /* new path length */ rlen = ntohl(rpc_pkt.u.reply.data[1 + nfsv3_data_offset]); + if (((uchar *)&(rpc_pkt.u.reply.data[0]) - (uchar *)(&rpc_pkt) + rlen) > len) + return -NFS_RPC_DROP; + if (*((char *)&(rpc_pkt.u.reply.data[2 + nfsv3_data_offset])) != '/') { int pathlen;