- Check buffer sizes and color counts for IOCTL_VIDEO_SET_COLOR_REGISTERS request.

svn path=/trunk/; revision=9464
This commit is contained in:
Filip Navara 2004-05-22 08:53:26 +00:00
parent 1c1f4e3945
commit ed16c950dc

View file

@ -473,9 +473,14 @@ VBEStartIO(
break;
case IOCTL_VIDEO_SET_COLOR_REGISTERS:
/*
* FIXME: Check buffer size!
*/
if (RequestPacket->InputBufferLength < sizeof(VIDEO_CLUT) ||
RequestPacket->InputBufferLength <
(((PVIDEO_CLUT)RequestPacket->InputBuffer)->NumEntries * sizeof(ULONG)) +
sizeof(VIDEO_CLUT))
{
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
return TRUE;
}
Result = VBESetColorRegisters(
(PVBE_DEVICE_EXTENSION)HwDeviceExtension,
(PVIDEO_CLUT)RequestPacket->InputBuffer,
@ -797,6 +802,9 @@ VBESetColorRegisters(
ULONG Entry;
PULONG OutputEntry;
if (ColorLookUpTable->NumEntries + ColorLookUpTable->FirstEntry > 256)
return FALSE;
if (DeviceExtension->VGACompatible)
{
for (Entry = ColorLookUpTable->FirstEntry;