From patchwork Mon May 16 14:33:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea zi0Black Cappa X-Patchwork-Id: 1631624 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=protonmail.com header.i=@protonmail.com header.a=rsa-sha256 header.s=protonmail2 header.b=kidqUGBy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L21w036pxz9s5V for ; Tue, 17 May 2022 00:33:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 93F0D84010; Mon, 16 May 2022 16:33:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=protonmail.com header.i=@protonmail.com header.b="kidqUGBy"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 182EF84010; Mon, 16 May 2022 16:33:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4928A83F36 for ; Mon, 16 May 2022 16:33:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zi0Black@protonmail.com Date: Mon, 16 May 2022 14:33:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1652711620; x=1652970820; bh=oeNrNox3MRB0Y0/Rsgz5l1vIoRxHexJDrdE2sbOmUmY=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:Feedback-ID:From:To: Cc:Date:Subject:Reply-To:Feedback-ID:Message-ID; b=kidqUGBykFDb3tDKocyQ5R1LuQURgNobsMNTYqRP4tWkmeTI0qm7TLJlBmP+3Iqlh pB1YN6D9eMHXDqqVG69xgk/idt1FUyjmo6FhTqG019VofX842FCmj0PII/MbovDb+C SV/4UL3u8WSKHA4d18D57Iupzc4SxXlb6ReyVqz8NLhrSHFhg3lux9a+xRTyFkmvot 0RGA5jXQq4WNDFVrrtY1x4zklkR5F57cqBWta2WDZurgk/+L2+RRE0gYIT5OVagn0g 0lchgk6BHQdtl5wWMQQ7xNfg6kPtsggQXJeLsSWEm8ejYcBl4qH2CqmBILQQXl5aO0 NFmnobb0HQsWA== To: u-boot@lists.denx.de From: Andrea zi0Black Cappa Cc: trini@konsulko.com, Andrea zi0Black Cappa Subject: [PATCH] Fix CVE-2022-30767 (old CVE-2019-14196) Message-ID: <20220516143345.1892-1-zi0Black@protonmail.com> Feedback-ID: 9529232:user:proton MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Andrea zi0Black Cappa Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Andrea zi0Black Cappa --- net/nfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.36.0.windows.1 diff --git a/net/nfs.c b/net/nfs.c index 3c01cebd96..9152ab742e 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -52,7 +52,7 @@ static const ulong nfs_timeout = CONFIG_NFS_TIMEOUT; static char dirfh[NFS_FHSIZE]; /* NFSv2 / NFSv3 file handle of directory */ static char filefh[NFS3_FHSIZE]; /* NFSv2 / NFSv3 file handle */ -static int filefh3_length; /* (variable) length of filefh when NFSv3 */ +static unsigned int filefh3_length; /* (variable) length of filefh when NFSv3 */ static enum net_loop_state nfs_download_state; static struct in_addr nfs_server_ip; @@ -573,8 +573,6 @@ static int nfs_lookup_reply(uchar *pkt, unsigned len) filefh3_length = ntohl(rpc_pkt.u.reply.data[1]); if (filefh3_length > NFS3_FHSIZE) filefh3_length = NFS3_FHSIZE; - if (((uchar *)&(rpc_pkt.u.reply.data[0]) - (uchar *)(&rpc_pkt) + filefh3_length ) > len) - return -NFS_RPC_DROP; memcpy(filefh, rpc_pkt.u.reply.data + 2, filefh3_length); }