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.65; helo=mga03.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 A8F0C21188465 for ; Tue, 30 Oct 2018 22:42:31 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 22:42:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,447,1534834800"; d="scan'208";a="82271014" Received: from jiaxinwu-mobl.ccr.corp.intel.com ([10.239.192.155]) by fmsmga007.fm.intel.com with ESMTP; 30 Oct 2018 22:42:30 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Ye Ting , Fu Siyuan , Wu Jiaxin Date: Wed, 31 Oct 2018 13:42:12 +0800 Message-Id: <20181031054212.3276-1-Jiaxin.wu@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 Subject: [PATCH v1] NetworkPkg/TlsDxe: Fix failure to process multiple TLS records. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2018 05:42:31 -0000 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1290. Current implementation failed to parse the multiple TLS record messages due to the incorrect pointer of TLS record header. This patch is to resolve that problem. Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin --- NetworkPkg/TlsDxe/TlsImpl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/TlsDxe/TlsImpl.c b/NetworkPkg/TlsDxe/TlsImpl.c index ea83dbd04f..2d4169b0a5 100644 --- a/NetworkPkg/TlsDxe/TlsImpl.c +++ b/NetworkPkg/TlsDxe/TlsImpl.c @@ -142,11 +142,11 @@ TlsEncryptPacket ( } BufferOutSize += ThisMessageSize; BufferInPtr += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize; - TempRecordHeader += ThisMessageSize; + TempRecordHeader = (TLS_RECORD_HEADER *)((UINT8 *)TempRecordHeader + ThisMessageSize); } FreePool (BufferIn); BufferIn = NULL; @@ -315,11 +315,11 @@ TlsDecryptPacket ( CopyMem (TempRecordHeader, RecordHeaderIn, TLS_RECORD_HEADER_LENGTH); TempRecordHeader->Length = ThisPlainMessageSize; BufferOutSize += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize; BufferInPtr += TLS_RECORD_HEADER_LENGTH + ThisCipherMessageSize; - TempRecordHeader += TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize; + TempRecordHeader = (TLS_RECORD_HEADER *)((UINT8 *)TempRecordHeader + TLS_RECORD_HEADER_LENGTH + ThisPlainMessageSize); } FreePool (BufferIn); BufferIn = NULL; -- 2.17.1.windows.2