Enabled the check of the correct buffer size in some functions.

svn path=/trunk/; revision=2334
This commit is contained in:
Hartmut Birr 2001-11-01 10:41:53 +00:00
parent 287fa79a6a
commit 24f81ff1c1

View file

@ -1,4 +1,4 @@
/* $Id: volume.c,v 1.12 2001/07/28 10:12:36 hbirr Exp $ /* $Id: volume.c,v 1.13 2001/11/01 10:41:53 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -38,9 +38,8 @@ FsdGetFsVolumeInformation(PFILE_OBJECT FileObject,
DPRINT("LabelLength %lu\n", LabelLength); DPRINT("LabelLength %lu\n", LabelLength);
DPRINT("Label %S\n", DeviceObject->Vpb->VolumeLabel); DPRINT("Label %S\n", DeviceObject->Vpb->VolumeLabel);
/* FIXME: This does not work correctly! Why?? */ if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength*sizeof(WCHAR)))
// if (*BufferLength < (sizeof(FILE_FS_VOLUME_INFORMATION) + LabelLength)); return(STATUS_BUFFER_OVERFLOW);
// return(STATUS_BUFFER_OVERFLOW);
/* valid entries */ /* valid entries */
FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber; FsVolumeInfo->VolumeSerialNumber = DeviceObject->Vpb->SerialNumber;
@ -100,9 +99,8 @@ FsdGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
DPRINT("FsdGetFsSizeInformation()\n"); DPRINT("FsdGetFsSizeInformation()\n");
DPRINT("FsSizeInfo = %p\n", FsSizeInfo); DPRINT("FsSizeInfo = %p\n", FsSizeInfo);
/* FIXME: This does not work correctly! Why?? */ if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION))
// if (*BufferLength < sizeof(FILE_FS_SIZE_INFORMATION)); return(STATUS_BUFFER_OVERFLOW);
// return(STATUS_BUFFER_OVERFLOW);
DeviceExt = DeviceObject->DeviceExtension; DeviceExt = DeviceObject->DeviceExtension;
@ -134,11 +132,11 @@ FsdGetFsSizeInformation(PDEVICE_OBJECT DeviceObject,
FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster; FsSizeInfo->SectorsPerAllocationUnit = BootSect->SectorsPerCluster;
FsSizeInfo->BytesPerSector = BootSect->BytesPerSector; FsSizeInfo->BytesPerSector = BootSect->BytesPerSector;
} }
DPRINT("Finished FsdGetFsSizeInformation()\n"); DPRINT("Finished FsdGetFsSizeInformation()\n");
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
*BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION); *BufferLength -= sizeof(FILE_FS_SIZE_INFORMATION);
return(Status); return(Status);
} }
@ -151,19 +149,18 @@ FsdGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo,
DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo); DPRINT("FsDeviceInfo = %p\n", FsDeviceInfo);
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION)); DPRINT("Required length %lu\n", sizeof(FILE_FS_DEVICE_INFORMATION));
/* FIXME: This does not work correctly! Why?? */ if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION))
// if (*BufferLength < sizeof(FILE_FS_DEVICE_INFORMATION)); return(STATUS_BUFFER_OVERFLOW);
// return(STATUS_BUFFER_OVERFLOW);
FsDeviceInfo->DeviceType = FILE_DEVICE_DISK; FsDeviceInfo->DeviceType = FILE_DEVICE_DISK;
FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */ FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */
DPRINT("FsdGetFsDeviceInformation() finished.\n"); DPRINT("FsdGetFsDeviceInformation() finished.\n");
*BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION); *BufferLength -= sizeof(FILE_FS_DEVICE_INFORMATION);
DPRINT("BufferLength %lu\n", *BufferLength); DPRINT("BufferLength %lu\n", *BufferLength);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -173,7 +170,7 @@ FsdSetFsLabelInformation(PDEVICE_OBJECT DeviceObject,
PFILE_FS_LABEL_INFORMATION FsLabelInfo) PFILE_FS_LABEL_INFORMATION FsLabelInfo)
{ {
DPRINT("FsdSetFsLabelInformation()\n"); DPRINT("FsdSetFsLabelInformation()\n");
return(STATUS_NOT_IMPLEMENTED); return(STATUS_NOT_IMPLEMENTED);
} }