diff options
author | Kun Qin <kuqin@microsoft.com> | 2023-06-29 16:59:18 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-09-08 12:48:57 +0000 |
commit | b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430 (patch) | |
tree | 35866c1dc08d0024424dafff3e69915f832c5fe2 /SecurityPkg | |
parent | ff7ddc02b273f9159ef46fdb67d99062f8e598d9 (diff) | |
download | edk2-b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430.tar.gz edk2-b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430.tar.bz2 edk2-b74f1f7ab5e956f58ae1771dc4e2a4b92bc51430.zip |
SecurityPkg: RngDxe: Fixing mAvailableAlgoArray allocator
REF: https://bugzilla.tianocore.org/show_bug.cgi?idD91
mAvailableAlgoArray is currently allocated for "RNG_AVAILABLE_ALGO_MAX"
number of bytes, whereas it was dereferenced as "EFI_RNG_ALGORITHM".
This change fixed the buffer allocation logic by allocating a proper size
of buffer before referencing.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Kun Qin <kuqin@microsoft.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Diffstat (limited to 'SecurityPkg')
-rw-r--r-- | SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c | 2 | ||||
-rw-r--r-- | SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c index a270441ebb..fe335f83df 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/AArch64Algo.c @@ -39,7 +39,7 @@ GetAvailableAlgorithms ( UnSafeAlgo = FALSE;
// Rng algorithms 2 times, one for the allocation, one to populate.
- mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX);
+ mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * sizeof (EFI_RNG_ALGORITHM));
if (mAvailableAlgoArray == NULL) {
return EFI_OUT_OF_RESOURCES;
}
diff --git a/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c b/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c index 4b24f5c4a6..5e621df601 100644 --- a/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c +++ b/SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c @@ -32,7 +32,7 @@ GetAvailableAlgorithms ( UINT16 MinorRevision;
// Rng algorithms 2 times, one for the allocation, one to populate.
- mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX);
+ mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * sizeof (EFI_RNG_ALGORITHM));
if (mAvailableAlgoArray == NULL) {
return EFI_OUT_OF_RESOURCES;
}
|