Fix Insert opcode error.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8105 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-04-17 01:46:37 +00:00
parent ad5a96ab2d
commit b8215f465c

View File

@ -1158,10 +1158,10 @@ HiiIsConfigHdrMatch (
buffer. The returned buffer is allocated using AllocatePool(). The caller buffer. The returned buffer is allocated using AllocatePool(). The caller
is responsible for freeing the returned buffer using FreePool(). is responsible for freeing the returned buffer using FreePool().
@param[in] VariableName Pointer to a Null-terminated Unicode string. This
is an optional parameter that may be NULL.
@param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional @param[in] VariableGuid Pointer to an EFI_GUID structure. This is an optional
parameter that may be NULL. parameter that may be NULL.
@param[in] VariableName Pointer to a Null-terminated Unicode string. This
is an optional parameter that may be NULL.
@param[in] BufferSize Length in bytes of buffer to hold retrived data. @param[in] BufferSize Length in bytes of buffer to hold retrived data.
@retval NULL The uncommitted data could not be retrieved. @retval NULL The uncommitted data could not be retrieved.
@ -2267,17 +2267,19 @@ InternalHiiUpdateFormPackageData (
// Insert the updated data // Insert the updated data
// //
UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer; UpdateIfrOpHdr = (EFI_IFR_OP_HEADER *) OpCodeBufferStart->Buffer;
AddOpCode = (EFI_IFR_OP_HEADER *) (OpCodeBufferStart->Buffer + UpdateIfrOpHdr->Length);
AddSize = UpdateIfrOpHdr->Length; AddSize = UpdateIfrOpHdr->Length;
AddOpCode = (EFI_IFR_OP_HEADER *) (OpCodeBufferStart->Buffer + AddSize);
while (AddSize < OpCodeBufferStart->Position) { while (AddSize < OpCodeBufferStart->Position) {
CopyMem (BufferPos, AddOpCode, AddOpCode->Length); CopyMem (BufferPos, AddOpCode, AddOpCode->Length);
BufferPos += AddOpCode->Length; BufferPos += AddOpCode->Length;
UpdatePackageLength += AddOpCode->Length; UpdatePackageLength += AddOpCode->Length;
AddOpCode = (EFI_IFR_OP_HEADER *) ((UINT8 *) (AddOpCode) + AddOpCode->Length); AddSize += AddOpCode->Length;
AddSize += AddOpCode->Length; AddOpCode = (EFI_IFR_OP_HEADER *) (OpCodeBufferStart->Buffer + AddSize);
} }
ASSERT (AddSize == OpCodeBufferStart->Position);
if (OpCodeBufferEnd != NULL) { if (OpCodeBufferEnd != NULL) {
// //
// Add the end opcode // Add the end opcode