X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseMemoryLib%2FCopyMem.c;h=3db25ca851a117175fe10daffb4dbba5c8e50b22;hp=6f4fd900df5d2e50729f27115646a8ea3cd789cb;hb=5ea2bad0d9ab6a2465195badd323313553baa61b;hpb=2048ab4b3ec966183eb87d93d9cdab05fe9cc840
diff --git a/MdePkg/Library/BaseMemoryLib/CopyMem.c b/MdePkg/Library/BaseMemoryLib/CopyMem.c
index 6f4fd900df..3db25ca851 100644
--- a/MdePkg/Library/BaseMemoryLib/CopyMem.c
+++ b/MdePkg/Library/BaseMemoryLib/CopyMem.c
@@ -3,7 +3,7 @@
out into its own source file so that it can be excluded from a build for a
particular platform easily if an optimized version is desired.
- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
Copyright (c) 2016, Linaro Ltd. All rights reserved.
@@ -143,10 +143,10 @@ InternalMemCopyMem (
*(Destination8++) = *(Source8++);
}
} else if (SourceBuffer < DestinationBuffer) {
- Destination8 = (UINT8*)DestinationBuffer + Length;
- Source8 = (CONST UINT8*)SourceBuffer + Length;
+ Destination8 = (UINT8*)DestinationBuffer + (Length - 1);
+ Source8 = (CONST UINT8*)SourceBuffer + (Length - 1);
while (Length-- != 0) {
- *(--Destination8) = *(--Source8);
+ *(Destination8--) = *(Source8--);
}
}
}