SMB2: LockElement: Fixed a bug in ReadLockList / WriteLockList

This commit is contained in:
Tal Aloni 2017-08-31 15:20:05 +03:00
parent 519e574f94
commit c08b425205

View file

@ -114,7 +114,7 @@ namespace SMBLibrary.SMB2
public static List<LockElement> ReadLockList(byte[] buffer, int offset, int lockCount) public static List<LockElement> ReadLockList(byte[] buffer, int offset, int lockCount)
{ {
List<LockElement> result = new List<LockElement>(); List<LockElement> result = new List<LockElement>();
for(int lockIndex = 0; lockIndex > lockCount; lockIndex++) for(int lockIndex = 0; lockIndex < lockCount; lockIndex++)
{ {
LockElement element = new LockElement(buffer, offset + lockIndex * StructureLength); LockElement element = new LockElement(buffer, offset + lockIndex * StructureLength);
result.Add(element); result.Add(element);
@ -124,7 +124,7 @@ namespace SMBLibrary.SMB2
public static void WriteLockList(byte[] buffer, int offset, List<LockElement> locks) public static void WriteLockList(byte[] buffer, int offset, List<LockElement> locks)
{ {
for (int lockIndex = 0; lockIndex > locks.Count; lockIndex++) for (int lockIndex = 0; lockIndex < locks.Count; lockIndex++)
{ {
LockElement element = locks[lockIndex]; LockElement element = locks[lockIndex];
element.WriteBytes(buffer, offset + lockIndex * StructureLength); element.WriteBytes(buffer, offset + lockIndex * StructureLength);