mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
MdeModulePkg/HiiDatabase: clean the value before setting default string
For string op-code, the default string may not reach the maximum size, so when generating <AltResp> string, we should clean the value before setting the default string. https://bugzilla.tianocore.org/show_bug.cgi?id=375 Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
5c793e7703
commit
bf342907c8
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.
|
Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -3581,6 +3581,7 @@ GenerateAltConfigResp (
|
|||||||
UINTN Width;
|
UINTN Width;
|
||||||
UINT8 *TmpBuffer;
|
UINT8 *TmpBuffer;
|
||||||
CHAR16 *DefaultString;
|
CHAR16 *DefaultString;
|
||||||
|
UINTN StrSize;
|
||||||
|
|
||||||
BlockData = NULL;
|
BlockData = NULL;
|
||||||
DataExist = FALSE;
|
DataExist = FALSE;
|
||||||
@ -3698,7 +3699,15 @@ GenerateAltConfigResp (
|
|||||||
//
|
//
|
||||||
if (BlockData->OpCode == EFI_IFR_STRING_OP){
|
if (BlockData->OpCode == EFI_IFR_STRING_OP){
|
||||||
DefaultString = InternalGetString(HiiHandle, DefaultValueData->Value.string);
|
DefaultString = InternalGetString(HiiHandle, DefaultValueData->Value.string);
|
||||||
TmpBuffer = (UINT8 *) DefaultString;
|
TmpBuffer = AllocateZeroPool (Width);
|
||||||
|
ASSERT (TmpBuffer != NULL);
|
||||||
|
if (DefaultString != NULL) {
|
||||||
|
StrSize = StrLen(DefaultString)* sizeof (CHAR16);
|
||||||
|
if (StrSize > Width) {
|
||||||
|
StrSize = Width;
|
||||||
|
}
|
||||||
|
CopyMem (TmpBuffer, (UINT8 *) DefaultString, StrSize);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
TmpBuffer = (UINT8 *) &(DefaultValueData->Value);
|
TmpBuffer = (UINT8 *) &(DefaultValueData->Value);
|
||||||
}
|
}
|
||||||
@ -3709,6 +3718,10 @@ GenerateAltConfigResp (
|
|||||||
FreePool(DefaultString);
|
FreePool(DefaultString);
|
||||||
DefaultString = NULL;
|
DefaultString = NULL;
|
||||||
}
|
}
|
||||||
|
if (BlockData->OpCode == EFI_IFR_STRING_OP && TmpBuffer != NULL) {
|
||||||
|
FreePool(TmpBuffer);
|
||||||
|
TmpBuffer = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user