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>
ASSERT (((UINTN) String & BIT0) == 0);\r
\r
//\r
- // If String is a null pointer, then the StrnLenS function returns zero.\r
+ // If String is a null pointer or MaxSize is 0, then the StrnLenS function returns zero.\r
//\r
- if (String == NULL) {\r
+ if ((String == NULL) || (MaxSize == 0)) {\r
return 0;\r
}\r
\r
UINTN Length;\r
\r
//\r
- // If String is a null pointer, then the AsciiStrnLenS function returns zero.\r
+ // If String is a null pointer or MaxSize is 0, then the AsciiStrnLenS function returns zero.\r
//\r
- if (String == NULL) {\r
+ if ((String == NULL) || (MaxSize == 0)) {\r
return 0;\r
}\r
\r