From 787c4baace1c0c49fa1628990402be8997294d17 Mon Sep 17 00:00:00 2001 From: Marvin Haeuser Date: Mon, 21 Oct 2019 01:28:14 +0800 Subject: [PATCH] MdePkg/UefiDebugLibStdErr: Pass the correct buffer size REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2302 The second argument of "UnicodeVSPrintAsciiFormat" is "BufferSize", which takes the size of the buffer in bytes. Replace the currently used MAX_DEBUG_MESSAGE_LENGTH usage, which is the buffer's length, with the actual buffer size. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Marvin Haeuser Reviewed-by: Liming Gao --- MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c index 40eb697e7e..fcfdafede0 100644 --- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c +++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c @@ -106,9 +106,9 @@ DebugPrintMarker ( // Convert the DEBUG() message to a Unicode String // if (BaseListMarker == NULL) { - UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, VaListMarker); + UnicodeVSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, VaListMarker); } else { - UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, BaseListMarker); + UnicodeBSPrintAsciiFormat (Buffer, sizeof (Buffer), Format, BaseListMarker); } //