MdeModulePkg/HiiDatabase: Do not modify CONST string

Update function behavior to not modify the incoming string that is
marked as CONST in the prototype.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
This commit is contained in:
Jeff Brasen 2020-09-12 01:08:42 +08:00 committed by mergify[bot]
parent 2d8ca4f90e
commit c640186ec8
1 changed files with 7 additions and 5 deletions

View File

@ -5497,7 +5497,6 @@ HiiBlockToConfig (
UINTN Index;
UINT8 *TemBuffer;
CHAR16 *TemString;
CHAR16 TemChar;
TmpBuffer = NULL;
@ -5564,10 +5563,13 @@ HiiBlockToConfig (
//
// Copy <ConfigHdr> and an additional '&' to <ConfigResp>
//
TemChar = *StringPtr;
*StringPtr = '\0';
AppendToMultiString(Config, ConfigRequest);
*StringPtr = TemChar;
TemString = AllocateCopyPool (sizeof (CHAR16) * (StringPtr - ConfigRequest + 1), ConfigRequest);
if (TemString == NULL) {
return EFI_OUT_OF_RESOURCES;
}
TemString[StringPtr - ConfigRequest] = '\0';
AppendToMultiString(Config, TemString);
FreePool (TemString);
//
// Parse each <RequestElement> if exists