summaryrefslogtreecommitdiffstats
path: root/src/win32.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-04-23 14:48:29 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2011-04-23 14:48:29 +0200
commit3c0ad725ff4404142c0a6d919978c4b7e1ce8c46 (patch)
tree754f389d037f9e8a1aa0f103307ee8c0013f7011 /src/win32.c
parentf5dc38627c949e2717e4252a370b1fb0743a4a25 (diff)
Reject sector size reported by Windows if bigger than 16MB
Diffstat (limited to 'src/win32.c')
-rw-r--r--src/win32.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/win32.c b/src/win32.c
index 8254302..845487b 100644
--- a/src/win32.c
+++ b/src/win32.c
@@ -74,12 +74,14 @@ unsigned int disk_get_sector_size_win32(HANDLE handle, const char *device, const
if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0,
&geometry_ex, sizeof(geometry_ex), &gotbytes, NULL))
{
- return geometry_ex.Geometry.BytesPerSector;
+ if(geometry_ex.Geometry.BytesPerSector <= (1<<24))
+ return geometry_ex.Geometry.BytesPerSector;
}
if (DeviceIoControl( handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,
&geometry, sizeof(geometry), &gotbytes, NULL))
{
- return geometry.BytesPerSector;
+ if(geometry.BytesPerSector <= (1<<24))
+ return geometry.BytesPerSector;
}
sector_size=file_win32_compute_sector_size(handle);
if(sector_size==0)