Re: [edk2-devel] [PATCH] NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite
Patch merged. PR: https://github.com/tianocore/edk2/pull/2536 Commit: https://github.com/tianocore/edk2/pull/2536/commits/18feb439545443e8a3488b82415023601d116fe4 W dniu 21-Feb-22 o 15:57, Maciej Rabeda pisze: Hi Heng, Thanks for the patch. Reviewed-by: Maciej Rabeda W dniu 26-Jan-22 o 06:12, Heng Luo pisze: 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 Cc: Fu Siyuan Cc: Wu Jiaxin Signed-off-by: Heng Luo --- NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c | 16 1 file 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 ); -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86837): https://edk2.groups.io/g/devel/message/86837 Mute This Topic: https://groups.io/mt/88690749/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite
Hi Heng, Thanks for the patch. Reviewed-by: Maciej Rabeda W dniu 26-Jan-22 o 06:12, Heng Luo pisze: 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 Cc: Fu Siyuan Cc: Wu Jiaxin Signed-off-by: Heng Luo --- NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c | 16 1 file 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 ); -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86828): https://edk2.groups.io/g/devel/message/86828 Mute This Topic: https://groups.io/mt/88690749/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite
Dear maintainers, Could you review this patch? Thanks, heng > -Original Message- > From: devel@edk2.groups.io On Behalf Of Heng Luo > Sent: Wednesday, January 26, 2022 1:12 PM > To: devel@edk2.groups.io > Cc: Maciej Rabeda ; Fu, Siyuan > ; Wu, Jiaxin > Subject: [edk2-devel] [PATCH] NetworkPkg: Fix incorrect unicode string of the > AKM/Cipher Suite > > 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 > Cc: Fu Siyuan > Cc: Wu Jiaxin > Signed-off-by: Heng Luo > --- > > NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c > | 16 > 1 file 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/WifiConnectionMgrHiiConfigAcce > +++ ss.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 >); > -- > 2.31.1.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86742): https://edk2.groups.io/g/devel/message/86742 Mute This Topic: https://groups.io/mt/88690749/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite
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 Cc: Fu Siyuan Cc: Wu Jiaxin Signed-off-by: Heng Luo --- NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c | 16 1 file 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 ); -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86076): https://edk2.groups.io/g/devel/message/86076 Mute This Topic: https://groups.io/mt/88690749/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-