mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-21 08:45:54 +02:00
Bugfix: SMB2 QUERY_DIRECTORY response buffer length sometimes exceeded the request's OutputBufferLength
This commit is contained in:
parent
29a18fbfea
commit
4f28519223
1 changed files with 4 additions and 2 deletions
|
@ -78,10 +78,12 @@ namespace SMBLibrary.Server.SMB2
|
||||||
return new ErrorResponse(request.CommandName, NTStatus.STATUS_INVALID_PARAMETER);
|
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);
|
page.Add(fileInformation);
|
||||||
pageLength += fileInformation.Length;
|
int paddedLength = (int)Math.Ceiling((double)entryLength / 8) * 8;
|
||||||
|
pageLength += paddedLength;
|
||||||
openSearch.EnumerationLocation = index + 1;
|
openSearch.EnumerationLocation = index + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue