/* This function is similar as strlen_s defined in C11. */
UINTN EFIAPI AsciiStrnLenS(IN CONST CHAR8 *String, IN UINTN MaxSize)
/* This function is similar as strlen_s defined in C11. */
UINTN EFIAPI AsciiStrnLenS(IN CONST CHAR8 *String, IN UINTN MaxSize)
{
  UINTN  Length;
  if ((String == NULL) || (MaxSize == 0)) {
    return 0;
  }
  Length = 0;
  while (String[Length] != 0) {
    if (Length >= MaxSize - 1) {
      return MaxSize;
    }
    Length++;
  }
  return Length;
}