mirror of
https://xff.cz/git/u-boot/
synced 2025-09-07 19:52:15 +02:00
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 <liucheng32@huawei.com> Reported-by: Fermín Serna <fermin@semmle.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
committed by
Joe Hershberger
parent
aa207cf3a6
commit
cf3a4f1e86
@@ -634,6 +634,9 @@ static int nfs_readlink_reply(uchar *pkt, unsigned len)
|
|||||||
/* new path length */
|
/* new path length */
|
||||||
rlen = ntohl(rpc_pkt.u.reply.data[1 + nfsv3_data_offset]);
|
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])) != '/') {
|
if (*((char *)&(rpc_pkt.u.reply.data[2 + nfsv3_data_offset])) != '/') {
|
||||||
int pathlen;
|
int pathlen;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user