]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Fix potential buffer overflow
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 1 Jul 2015 15:11:22 +0000 (16:11 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 2 Jul 2015 09:30:39 +0000 (10:30 +0100)
The __min in XENFILT's FdoQueryDeviceRelations() should be a __max. The only
reason this mistake did not lead to an immediate buffer overflow was because
the allocation incorrectly used sizeof (DEVICE_OBJECT) rather than
sizeof (PDEVICE_OBJECT).

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenfilt/fdo.c

index 42a40e8a63ce1bb08314bb0096ecdef77ffef382..cff179baab51ddcb1c2103474bfbdbed63a7979c 100644 (file)
@@ -1160,7 +1160,7 @@ FdoQueryDeviceRelations(
     }
 
     Size = FIELD_OFFSET(DEVICE_RELATIONS, Objects) +
-           (sizeof (DEVICE_OBJECT) * __min(Count, 1));
+           (sizeof (PDEVICE_OBJECT) * __max(Count, 1));
 
     Relations = __AllocatePoolWithTag(PagedPool, Size, 'TLIF');