summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-07 09:45:18 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-01-07 09:45:18 +0000
commitd6039b1d6e83345e7354029ce104f87e304a5a5c (patch)
tree66dc6bfcff1feeb3cf7731d5bc03386f26f3caae /MdePkg
parentdc4dc1ded8ddf3ed9743631472ddc591b059a229 (diff)
downloadedk2-platforms-d6039b1d6e83345e7354029ce104f87e304a5a5c.tar.xz
Fix memory overflow.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7203 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Library/BasePrintLib/PrintLibInternal.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
index d87513042e..05e3ed501d 100644
--- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c
+++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c
@@ -77,11 +77,17 @@ BasePrintLibFillBuffer (
)
{
INTN Index;
-
- for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
- *Buffer = (CHAR8) Character;
- *(Buffer + 1) = (CHAR8) (Character >> 8);
- Buffer += Increment;
+ if(Increment != 1) {
+ for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
+ *Buffer = (CHAR8) Character;
+ *(Buffer + 1) = (CHAR8) (Character >> 8);
+ }
+ Buffer += Increment;
+ } else {
+ for (Index = 0; Index < Length && Buffer < EndBuffer; Index++) {
+ *Buffer = (CHAR8) Character;
+ }
+ Buffer += Increment;
}
return Buffer;
}