Fix the corner case when there is only "\0\0" appended and the Index is 1. Return missing string instead of empty string.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10914 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -677,7 +677,11 @@ GetOptionalStringByIndex (
|
|||||||
StrSize = AsciiStrSize (OptionalStrStart);
|
StrSize = AsciiStrSize (OptionalStrStart);
|
||||||
} while (OptionalStrStart[StrSize] != 0 && Index != 0);
|
} while (OptionalStrStart[StrSize] != 0 && Index != 0);
|
||||||
|
|
||||||
if (Index != 0) {
|
if ((Index != 0) || (StrSize == 1)) {
|
||||||
|
//
|
||||||
|
// Meet the end of strings set but Index is non-zero, or
|
||||||
|
// Find an empty string
|
||||||
|
//
|
||||||
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
||||||
} else {
|
} else {
|
||||||
*String = AllocatePool (StrSize * sizeof (CHAR16));
|
*String = AllocatePool (StrSize * sizeof (CHAR16));
|
||||||
|
Reference in New Issue
Block a user