diff options
author | Jeff Brasen <jbrasen@nvidia.com> | 2020-09-12 01:08:42 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-10-07 04:20:56 +0000 |
commit | c640186ec8aae6164123ee38de6409aed69eab12 (patch) | |
tree | 46747f52e3443e8349e36549b31be2782a7df3f4 /MdeModulePkg | |
parent | 2d8ca4f90eaeb61bd7e9903b56bf412f0d187137 (diff) | |
download | edk2-c640186ec8aae6164123ee38de6409aed69eab12.zip edk2-c640186ec8aae6164123ee38de6409aed69eab12.tar.gz edk2-c640186ec8aae6164123ee38de6409aed69eab12.tar.bz2 |
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 2cad6d2..d492b76 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -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
|