From b1a4c981ecada2b0043e17f9093b62eedb58611f Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 27 Mar 2009 03:35:45 +0000 Subject: Fix a minor issue to ensure the converted RFC 3066 language is NULL-terminated. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7967 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiString.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c b/MdeModulePkg/Library/UefiHiiLib/HiiString.c index 13f7e74a2c..333c29fc3b 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c @@ -553,10 +553,15 @@ ConvertIso639LanguageToRfc3066Language ( ) { UINTN Index; + CHAR8 *Rfc3066Language; for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) { if (CompareMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3) == 0) { - return AllocateCopyPool (2, &Iso639ToRfc3066ConversionTable[Index + 3]); + Rfc3066Language = AllocateZeroPool (3); + if (Rfc3066Language != NULL) { + Rfc3066Language = CopyMem (Rfc3066Language, &Iso639ToRfc3066ConversionTable[Index + 3], 2); + } + return Rfc3066Language; } } -- cgit v1.2.3