From nobody Thu Mar 28 17:48:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+70144+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70144+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610435343; cv=none; d=zohomail.com; s=zohoarc; b=CkF0g177dUwsMyeojxK7+wWDt8GCBNlWsOkQtNyiZdJlGKphynkUZKBtiZPm5ugLggiuAzNeIOYkLms+sdxvDOeQbnuiM015nbiZZ1YeS97F6EX0UDAdDRBYGPpAlE+587xpay6Vl3PVDndPWq4aDwdnn/31iHftrZLiH9tICmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610435343; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=JU7/b5z3Pu+LklkYMf+gUXnN2BXJL6SCCrS1f/TGb7o=; b=FSI3uBnlBW3DBe9iiTU7ICX4dhhibFNeEoQRVE08FtmqKocEL2iuRXzVc9SR+JPGHFGckIPGJ92awpCvn93g+Me5Ml12VGLwG06t1Mh5ZnaqBKIexZvTUXiFEKakKnDOe9+bHHAPAUQHSS2E928OOROscTiPZZqLcW0uaScCVxU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+70144+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610435343140165.77326465568876; Mon, 11 Jan 2021 23:09:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LZJIYY1788612xCd4nKikchH; Mon, 11 Jan 2021 23:08:57 -0800 X-Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web12.5915.1610435336334054204 for ; Mon, 11 Jan 2021 23:08:57 -0800 X-Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DFM9271Yvz7TB0 for ; Tue, 12 Jan 2021 15:07:50 +0800 (CST) X-Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Tue, 12 Jan 2021 15:08:45 +0800 From: "wenyi,xie via groups.io" To: , , , , CC: , Subject: [edk2-devel] [PATCH EDK2 v1 1/1] MdeModulePkg/FileExplorerLib: Add return value check Date: Tue, 12 Jan 2021 15:06:38 +0800 Message-ID: <1610435198-12504-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1610435198-12504-1-git-send-email-xiewenyi2@huawei.com> References: <1610435198-12504-1-git-send-email-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,xiewenyi2@huawei.com X-Gm-Message-State: aEBM3XdNumoZ0sS5rr6lDZ12x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610435337; bh=ekZFZ6tWO8B4lCUnTSJw4Z2n9xH5YaJu1FTE7rwcLRw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ScvEePMo4NOczoyI7w2fjACeCBqymH99bYPV03S03MrG8Gl3tow7LtvUEj1/PNsN8S0 rW0L5YbVuzTpUHGynaTcf1ENSNAmJ7HrTQkiPAQQqac4gSuOkW0XRoGLgPl9uajP/67JM gQt33qhY7OMbH/IpRWA7byKqH833hjwwbLY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3113 According to FAT specification, the length of file path should not larger than 260. When the length exceed 260, function FatLocateOFile will return EFI_INVALID_PARAMETER and the parameter FileHandle will be NULL. Then on the top-level function=EF=BC=8Can exception happens when the NULL pointer is passed and be used. So adding return value check after calling LibGetFileHandleFromMenu, if return value is not success, stop calling LibFindFiles. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Eric Dong Signed-off-by: Wenyi Xie Reviewed-by: Dandan Bi Reviewed-by: Liming Gao --- MdeModulePkg/Library/FileExplorerLib/FileExplorer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c b/MdeModul= ePkg/Library/FileExplorerLib/FileExplorer.c index 13a214b06af9..03630a29bc3b 100644 --- a/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c +++ b/MdeModulePkg/Library/FileExplorerLib/FileExplorer.c @@ -1408,12 +1408,14 @@ LibUpdateFileExplorer ( if (NewFileContext->IsDir) { RemoveEntryList (&NewMenuEntry->Link); LibFreeMenu (gFileExplorerPrivate.FsOptionMenu); - LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle); - Status =3D LibFindFiles (FileHandle, NewFileContext->FileName, NewFile= Context->DeviceHandle); + Status =3D LibGetFileHandleFromMenu (NewMenuEntry, &FileHandle); if (!EFI_ERROR (Status)) { - LibUpdateFileExplorePage (); - } else { - LibFreeMenu (gFileExplorerPrivate.FsOptionMenu); + Status =3D LibFindFiles (FileHandle, NewFileContext->FileName, NewFi= leContext->DeviceHandle); + if (!EFI_ERROR (Status)) { + LibUpdateFileExplorePage (); + } else { + LibFreeMenu (gFileExplorerPrivate.FsOptionMenu); + } } LibDestroyMenuEntry (NewMenuEntry); } --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#70144): https://edk2.groups.io/g/devel/message/70144 Mute This Topic: https://groups.io/mt/79618414/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-