Browse Source

SMB2: LockElement: Fixed a bug in ReadLockList / WriteLockList

Tal Aloni 7 years ago
parent
commit
c08b425205
1 changed files with 2 additions and 2 deletions
  1. 2 2
      SMBLibrary/SMB2/Structures/LockElement.cs

+ 2 - 2
SMBLibrary/SMB2/Structures/LockElement.cs

@@ -114,7 +114,7 @@ namespace SMBLibrary.SMB2
         public static List<LockElement> ReadLockList(byte[] buffer, int offset, int lockCount)
         {
             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);
                 result.Add(element);
@@ -124,7 +124,7 @@ namespace SMBLibrary.SMB2
 
         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];
                 element.WriteBytes(buffer, offset + lockIndex * StructureLength);