audk/MdePkg
Leif Lindholm 2ad9cf37a4 MdePkg: ensure SafeString length functions don't access beyond MaxSize
The StrnLenS and AsciiStrnLenS functions, when presented with a string
with no terminating NULL in the first MaxSize characters will check
the character at String[MaxSize] before checking if Length < MaxSize.
(They return the correct value, but have accessed beyond the stated
limit in the process.)

Flip the order of the tests to prevent this behaviour.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17936 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-13 11:35:28 +00:00
..
Include MdePkg: Add UEFI2.5 Ramdisk device path definition 2015-07-08 05:49:07 +00:00
Library MdePkg: ensure SafeString length functions don't access beyond MaxSize 2015-07-13 11:35:28 +00:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
License.txt Update copyright format 2012-04-24 06:49:39 +00:00
MdePkg.dec MdePkg: Add UEFI2.5 Ramdisk device path definition 2015-07-08 05:49:07 +00:00
MdePkg.dsc Add SmmMemLib, which can be used by SMM driver or SMM core to check communication buffer. 2015-02-02 14:40:44 +00:00
MdePkg.uni MdePkg: Correct Help of Error Level 2015-02-06 06:39:16 +00:00
MdePkgExtra.uni MdePkg: INF/DEC file updates to EDK II packages 2014-08-27 09:39:59 +00:00