AsciiStrLen is one byte too short, thus whether the space allocated is really
sufficient and whether the resultant string is really null-terminated becomes
implementation-dependent. An explicitly compile-time string length calculation
might be even more ideal, but AsciiStrSize matches usage elsewhere in the
codebase.
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
---
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
index 96e05d4cf9..f67b7760f0 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigKeywordHandler.c
@@ -1987,7 +1987,7 @@ GetNameFromId (
NULL
);
if (BestLanguage == NULL) {
- BestLanguage = AllocateCopyPool (AsciiStrLen ("en-US"), "en-US");
+ BestLanguage = AllocateCopyPool (AsciiStrSize ("en-US"), "en-US");
ASSERT (BestLanguage != NULL);
}
--
2.41.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108345): https://edk2.groups.io/g/devel/message/108345
Mute This Topic: https://groups.io/mt/101204385/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-