summaryrefslogtreecommitdiffstats
path: root/NetworkPkg/WifiConnectionManagerDxe
diff options
context:
space:
mode:
authorHeng Luo <heng.luo@intel.com>2022-01-26 13:12:21 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-02-21 15:19:40 +0000
commitb24306f15daa2ff8510b06702114724b33895d3c (patch)
tree0e51d722c5a1c2786d0527ffb41d065e0033ded4 /NetworkPkg/WifiConnectionManagerDxe
parent8a576733162bb72afb4d1eb3012b0aef8d265018 (diff)
downloadedk2-b24306f15daa2ff8510b06702114724b33895d3c.tar.gz
edk2-b24306f15daa2ff8510b06702114724b33895d3c.tar.bz2
edk2-b24306f15daa2ff8510b06702114724b33895d3c.zip
NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suiteedk2-stable202202
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3813 The size of buffer should be 3 CHAR16 for Null-terminated Unicode string. The first char is the AKM/Cipher Suite number, the second char is ' ', the third char is '\0'. Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Signed-off-by: Heng Luo <heng.luo@intel.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Diffstat (limited to 'NetworkPkg/WifiConnectionManagerDxe')
-rw-r--r--NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c
index b49825bcb7..7cb2bfc281 100644
--- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c
+++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c
@@ -280,12 +280,16 @@ WifiMgrGetStrAKMList (
//
// Current AKM Suite is between 1-9
//
- AKMListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * AKMSuiteCount * 2);
+ AKMListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * (AKMSuiteCount * 2 + 1));
if (AKMListDisplay != NULL) {
for (Index = 0; Index < AKMSuiteCount; Index++) {
+ //
+ // The size of buffer should be 3 CHAR16 for Null-terminated Unicode string.
+ // The first char is the AKM Suite number, the second char is ' ', the third char is '\0'.
+ //
UnicodeSPrint (
AKMListDisplay + (Index * 2),
- sizeof (CHAR16) * 2,
+ sizeof (CHAR16) * 3,
L"%d ",
Profile->Network.AKMSuite->AKMSuiteList[Index].SuiteType
);
@@ -333,12 +337,16 @@ WifiMgrGetStrCipherList (
//
// Current Cipher Suite is between 1-9
//
- CipherListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * CipherSuiteCount * 2);
+ CipherListDisplay = (CHAR16 *)AllocateZeroPool (sizeof (CHAR16) * (CipherSuiteCount * 2 + 1));
if (CipherListDisplay != NULL) {
for (Index = 0; Index < CipherSuiteCount; Index++) {
+ //
+ // The size of buffer should be 3 CHAR16 for Null-terminated Unicode string.
+ // The first char is the Cipher Suite number, the second char is ' ', the third char is '\0'.
+ //
UnicodeSPrint (
CipherListDisplay + (Index * 2),
- sizeof (CHAR16) * 2,
+ sizeof (CHAR16) * 3,
L"%d ",
Profile->Network.CipherSuite->CipherSuiteList[Index].SuiteType
);