mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-14 05:15:03 +02:00
NTDirectoryFileSystem: QueryDirectory / GetFileSystemInformation: Prevent possibility of reading data beyond the number of bytes written
This commit is contained in:
parent
d00d097b34
commit
fbb229d2c5
1 changed files with 5 additions and 1 deletions
|
@ -264,9 +264,11 @@ namespace SMBLibrary.Win32
|
|||
{
|
||||
return status;
|
||||
}
|
||||
restartScan = false;
|
||||
int numberOfBytesWritten = (int)ioStatusBlock.Information;
|
||||
buffer = ByteReader.ReadBytes(buffer, 0, numberOfBytesWritten);
|
||||
List<QueryDirectoryFileInformation> page = QueryDirectoryFileInformation.ReadFileInformationList(buffer, 0, informationClass);
|
||||
result.AddRange(page);
|
||||
restartScan = false;
|
||||
}
|
||||
fileNameStructure.Dispose();
|
||||
return NTStatus.STATUS_SUCCESS;
|
||||
|
@ -353,6 +355,8 @@ namespace SMBLibrary.Win32
|
|||
CloseFile(volumeHandle);
|
||||
if (status == NTStatus.STATUS_SUCCESS)
|
||||
{
|
||||
int numberOfBytesWritten = (int)ioStatusBlock.Information;
|
||||
buffer = ByteReader.ReadBytes(buffer, 0, numberOfBytesWritten);
|
||||
result = FileSystemInformation.GetFileSystemInformation(buffer, 0, informationClass);
|
||||
}
|
||||
return status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue