mirror of https://github.com/acidanthera/audk.git
MdePkg/BaseLib: Refine logic for (Ascii)StrnLenS to handle MaxSize = 0
https://bugzilla.tianocore.org/show_bug.cgi?id=378 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
5e9e151c20
commit
cb8674999c
|
@ -128,9 +128,9 @@ StrnLenS (
|
||||||
ASSERT (((UINTN) String & BIT0) == 0);
|
ASSERT (((UINTN) String & BIT0) == 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If String is a null pointer, then the StrnLenS function returns zero.
|
// If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.
|
||||||
//
|
//
|
||||||
if (String == NULL) {
|
if ((String == NULL) || (MaxSize == 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1097,9 +1097,9 @@ AsciiStrnLenS (
|
||||||
UINTN Length;
|
UINTN Length;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If String is a null pointer, then the AsciiStrnLenS function returns zero.
|
// If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function returns zero.
|
||||||
//
|
//
|
||||||
if (String == NULL) {
|
if ((String == NULL) || (MaxSize == 0)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue