From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8284E222CB30D for ; Thu, 21 Dec 2017 23:02:32 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Dec 2017 23:07:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,439,1508828400"; d="scan'208";a="3965855" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.141]) by fmsmga002.fm.intel.com with ESMTP; 21 Dec 2017 23:07:21 -0800 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Fu Siyuan , Wang Fan , Ye Ting , Wu Jiaxin Date: Fri, 22 Dec 2017 15:07:17 +0800 Message-Id: <1513926438-4160-2-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1513926438-4160-1-git-send-email-jiaxin.wu@intel.com> References: <1513926438-4160-1-git-send-email-jiaxin.wu@intel.com> Subject: [Patch 1/3] NetworkPkg/TcpDxe: Check FragmentBuffer for NULL before use X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Dec 2017 07:02:32 -0000 According the Spec, the FragmentBuffers in FragmentTable are allocated by the application when calling Receive() function. This patch is to check whether the FragmentBuffer is valid or not. Cc: Fu Siyuan Cc: Wang Fan Cc: Ye Ting Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- NetworkPkg/TcpDxe/TcpMain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NetworkPkg/TcpDxe/TcpMain.c b/NetworkPkg/TcpDxe/TcpMain.c index fc3713e..e349d2d 100644 --- a/NetworkPkg/TcpDxe/TcpMain.c +++ b/NetworkPkg/TcpDxe/TcpMain.c @@ -38,10 +38,13 @@ TcpChkDataBuf ( UINT32 Index; UINT32 Len; for (Index = 0, Len = 0; Index < FragmentCount; Index++) { + if (FragmentTable[Index].FragmentBuffer == NULL) { + return EFI_INVALID_PARAMETER; + } Len = Len + FragmentTable[Index].FragmentLength; } if (DataLen != Len) { return EFI_INVALID_PARAMETER; -- 1.9.5.msysgit.1