render / rpms / edk2

Forked from rpms/edk2 2 months ago
Clone

Blame SOURCES/edk2-NetworkPkg-IScsiDxe-simplify-ISCSI_CHAP_AUTH_DATA.In.patch

b6c182
From 0dac937f2845a1bc4943a0cfed3392d35afba733 Mon Sep 17 00:00:00 2001
b6c182
From: Laszlo Ersek <lersek@redhat.com>
b6c182
Date: Tue, 8 Jun 2021 14:12:51 +0200
b6c182
Subject: [PATCH 02/10] NetworkPkg/IScsiDxe: simplify
b6c182
 "ISCSI_CHAP_AUTH_DATA.InChallenge" size
b6c182
MIME-Version: 1.0
b6c182
Content-Type: text/plain; charset=UTF-8
b6c182
Content-Transfer-Encoding: 8bit
b6c182
b6c182
RH-Author: Laszlo Ersek <lersek@redhat.com>
b6c182
RH-MergeRequest: 5: NetworkPkg/IScsiDxe: fix IScsiHexToBin() security and functionality bugs [rhel-8.5.0, post-rebase]
b6c182
RH-Commit: [2/10] 8b57211651e13185a636daa5369993054bd7334b
b6c182
RH-Bugzilla: 1956408
b6c182
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
b6c182
b6c182
The ISCSI_CHAP_AUTH_MAX_LEN macro is defined with value 1024.
b6c182
b6c182
The usage of this macro currently involves a semantic (not functional)
b6c182
bug, which we're going to fix in a subsequent patch, eliminating
b6c182
ISCSI_CHAP_AUTH_MAX_LEN altogether.
b6c182
b6c182
For now, remove the macro's usage from all
b6c182
"ISCSI_CHAP_AUTH_DATA.InChallenge" contexts. This is doable without
b6c182
duplicating open-coded constants.
b6c182
b6c182
No changes in functionality.
b6c182
b6c182
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
b6c182
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
b6c182
Cc: Philippe Mathieu-Daud <philmd@redhat.com>
b6c182
Cc: Siyuan Fu <siyuan.fu@intel.com>
b6c182
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3356
b6c182
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
b6c182
Reviewed-by: Philippe Mathieu-Daud <philmd@redhat.com>
b6c182
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
b6c182
Message-Id: <20210608121259.32451-3-lersek@redhat.com>
b6c182
(cherry picked from commit 29cab43bb7912a12efa5a78dac15394aee866e4c)
b6c182
---
b6c182
 NetworkPkg/IScsiDxe/IScsiCHAP.c | 2 +-
b6c182
 NetworkPkg/IScsiDxe/IScsiCHAP.h | 2 +-
b6c182
 2 files changed, 2 insertions(+), 2 deletions(-)
b6c182
b6c182
diff --git a/NetworkPkg/IScsiDxe/IScsiCHAP.c b/NetworkPkg/IScsiDxe/IScsiCHAP.c
b6c182
index cbbc56ae5b..df3c2eb120 100644
b6c182
--- a/NetworkPkg/IScsiDxe/IScsiCHAP.c
b6c182
+++ b/NetworkPkg/IScsiDxe/IScsiCHAP.c
b6c182
@@ -289,7 +289,7 @@ IScsiCHAPOnRspReceived (
b6c182
     }
b6c182
 
b6c182
     AuthData->InIdentifier      = (UINT32) Result;
b6c182
-    AuthData->InChallengeLength = ISCSI_CHAP_AUTH_MAX_LEN;
b6c182
+    AuthData->InChallengeLength = (UINT32) sizeof (AuthData->InChallenge);
b6c182
     IScsiHexToBin (
b6c182
       (UINT8 *) AuthData->InChallenge,
b6c182
       &AuthData->InChallengeLength,
b6c182
diff --git a/NetworkPkg/IScsiDxe/IScsiCHAP.h b/NetworkPkg/IScsiDxe/IScsiCHAP.h
b6c182
index 5e59fb678b..1fc1d96ea3 100644
b6c182
--- a/NetworkPkg/IScsiDxe/IScsiCHAP.h
b6c182
+++ b/NetworkPkg/IScsiDxe/IScsiCHAP.h
b6c182
@@ -49,7 +49,7 @@ typedef struct _ISCSI_CHAP_AUTH_CONFIG_NVDATA {
b6c182
 typedef struct _ISCSI_CHAP_AUTH_DATA {
b6c182
   ISCSI_CHAP_AUTH_CONFIG_NVDATA *AuthConfig;
b6c182
   UINT32                        InIdentifier;
b6c182
-  UINT8                         InChallenge[ISCSI_CHAP_AUTH_MAX_LEN];
b6c182
+  UINT8                         InChallenge[1024];
b6c182
   UINT32                        InChallengeLength;
b6c182
   //
b6c182
   // Calculated CHAP Response (CHAP_R) value.
b6c182
-- 
b6c182
2.27.0
b6c182