audk/MdePkg/Library/BasePrintLib
Hao Wu b1d4b9651e MdePkg/BasePrintLib: Avoid reading content beyond the format string
https://bugzilla.tianocore.org/show_bug.cgi?id=567

In function BasePrintLibSPrintMarker(), when processing ASCII format
strings, if the format string walker pointer 'Format' is pointing at the
end of the format string (i.e. '\0'), the following expression:
*(Format + 1)
will read an undefined value.

Though this value won't affect the functionality, since it will be masked
by variable 'FormatMask':
(*(Format + 1) << 8)) & FormatMask
(FormatMask is 0xff for ASCII format string)

This commit adds additional logic to avoid reading undefined content.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-06-01 08:46:31 +08:00
..
BasePrintLib.inf MdePkg/BasePrintLib: Refine the SPrint functions 2017-02-21 13:55:13 +08:00
BasePrintLib.uni MdePkg: Convert all .uni files to utf-8 2015-12-15 04:53:50 +00:00
PrintLib.c MdePkg/BasePrintLib: Refine the comment for AsciiValueToStringS API 2017-03-13 11:09:23 +08:00
PrintLibInternal.c MdePkg/BasePrintLib: Avoid reading content beyond the format string 2017-06-01 08:46:31 +08:00
PrintLibInternal.h MdePkg/BasePrintLib: Add safe print functions [A|U]ValueToStringS 2017-02-21 13:56:14 +08:00