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