FileTimeHelper.ReadNullableFileTime: throw InvalidDataException if FILETIME is negative

This commit is contained in:
Tal Aloni 2017-02-07 14:11:44 +02:00
parent 3ed2bbcd1c
commit bef9bd6e69

View file

@ -52,10 +52,14 @@ namespace SMBLibrary
{ {
return DateTime.FromFileTimeUtc(span); return DateTime.FromFileTimeUtc(span);
} }
else else if (span == 0)
{ {
return null; return null;
} }
else
{
throw new System.IO.InvalidDataException("FILETIME cannot be negative");
}
} }
public static DateTime? ReadNullableFileTime(byte[] buffer, ref int offset) public static DateTime? ReadNullableFileTime(byte[] buffer, ref int offset)