diff --git a/SMBLibrary/Server/SMB2/QueryDirectoryHelper.cs b/SMBLibrary/Server/SMB2/QueryDirectoryHelper.cs index c7f1cf0..7f34f12 100644 --- a/SMBLibrary/Server/SMB2/QueryDirectoryHelper.cs +++ b/SMBLibrary/Server/SMB2/QueryDirectoryHelper.cs @@ -78,10 +78,12 @@ namespace SMBLibrary.Server.SMB2 return new ErrorResponse(request.CommandName, NTStatus.STATUS_INVALID_PARAMETER); } - if (pageLength + fileInformation.Length <= request.OutputBufferLength) + int entryLength = fileInformation.Length; + if (pageLength + entryLength <= request.OutputBufferLength) { page.Add(fileInformation); - pageLength += fileInformation.Length; + int paddedLength = (int)Math.Ceiling((double)entryLength / 8) * 8; + pageLength += paddedLength; openSearch.EnumerationLocation = index + 1; } else