mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
MdePkg/BasePrintLib: Do not do operations with NULL
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel <Harry.Liebel@arm.com> Reviewed-By: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Gao, Liming <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15646 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
85e2e0854b
commit
28087ef09f
@ -373,10 +373,13 @@ BasePrintLibSPrintMarker (
|
|||||||
}
|
}
|
||||||
|
|
||||||
LengthToReturn = 0;
|
LengthToReturn = 0;
|
||||||
|
EndBuffer = NULL;
|
||||||
|
OriginalBuffer = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reserve space for the Null terminator.
|
// Reserve space for the Null terminator.
|
||||||
//
|
//
|
||||||
|
if (Buffer != NULL) {
|
||||||
BufferSize--;
|
BufferSize--;
|
||||||
OriginalBuffer = Buffer;
|
OriginalBuffer = Buffer;
|
||||||
|
|
||||||
@ -384,6 +387,7 @@ BasePrintLibSPrintMarker (
|
|||||||
// Set the tag for the end of the input Buffer.
|
// Set the tag for the end of the input Buffer.
|
||||||
//
|
//
|
||||||
EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;
|
EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;
|
||||||
|
}
|
||||||
|
|
||||||
if ((Flags & FORMAT_UNICODE) != 0) {
|
if ((Flags & FORMAT_UNICODE) != 0) {
|
||||||
//
|
//
|
||||||
@ -411,7 +415,10 @@ BasePrintLibSPrintMarker (
|
|||||||
//
|
//
|
||||||
// Loop until the end of the format string is reached or the output buffer is full
|
// Loop until the end of the format string is reached or the output buffer is full
|
||||||
//
|
//
|
||||||
while (FormatCharacter != 0 && Buffer < EndBuffer) {
|
while (FormatCharacter != 0) {
|
||||||
|
if ((Buffer != NULL) && (Buffer >= EndBuffer)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Clear all the flag bits except those that may have been passed in
|
// Clear all the flag bits except those that may have been passed in
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user