Use ReadUnaligned32() instead of CopyMem()

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5604 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney 2008-08-01 23:21:07 +00:00
parent 520c936919
commit 7fd58cbc7e
2 changed files with 6 additions and 5 deletions

View File

@ -16,6 +16,7 @@
#include <Base.h> #include <Base.h>
#include <Library/BaseLib.h>
#include <Library/UefiDecompressLib.h> #include <Library/UefiDecompressLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
@ -689,19 +690,18 @@ UefiDecompressGetInfo (
ASSERT (DestinationSize != NULL); ASSERT (DestinationSize != NULL);
ASSERT (ScratchSize != NULL); ASSERT (ScratchSize != NULL);
*ScratchSize = sizeof (SCRATCH_DATA);
if (SourceSize < 8) { if (SourceSize < 8) {
return RETURN_INVALID_PARAMETER; return RETURN_INVALID_PARAMETER;
} }
CopyMem (&CompressedSize, Source, sizeof (UINT32)); CompressedSize = ReadUnaligned32 ((UINT32 *)Source);
CopyMem (DestinationSize, (VOID *)((UINT8 *)Source + 4), sizeof (UINT32));
if (SourceSize < (CompressedSize + 8)) { if (SourceSize < (CompressedSize + 8)) {
return RETURN_INVALID_PARAMETER; return RETURN_INVALID_PARAMETER;
} }
*ScratchSize = sizeof (SCRATCH_DATA);
*DestinationSize = ReadUnaligned32 ((UINT32 *)Source + 1);
return RETURN_SUCCESS; return RETURN_SUCCESS;
} }

View File

@ -39,6 +39,7 @@
[LibraryClasses] [LibraryClasses]
BaseLib
BaseMemoryLib BaseMemoryLib
DebugLib DebugLib