diff options
author | gikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-07 09:45:18 +0000 |
---|---|---|
committer | gikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-01-07 09:45:18 +0000 |
commit | d6039b1d6e83345e7354029ce104f87e304a5a5c (patch) | |
tree | 66dc6bfcff1feeb3cf7731d5bc03386f26f3caae /MdePkg | |
parent | dc4dc1ded8ddf3ed9743631472ddc591b059a229 (diff) | |
download | edk2-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.c | 16 |
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;
}
|