Fix crash when a invalid device is received in rdpdr_process_irp.

Thanks goes to David Fries for the patch.



git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1701 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Henrik Andersson 2013-03-22 10:17:11 +00:00
parent 81641e5b4d
commit 5b1e084fe2

View File

@ -379,6 +379,14 @@ rdpdr_process_irp(STREAM s)
buffer = (uint8 *) xmalloc(1024); buffer = (uint8 *) xmalloc(1024);
buffer[0] = 0; buffer[0] = 0;
if (device >= RDPDR_MAX_DEVICES)
{
error("invalid irp device 0x%lx file 0x%lx id 0x%lx major 0x%lx minor 0x%lx\n",
device, file, id, major, minor);
xfree(buffer);
return;
}
switch (g_rdpdr_device[device].device_type) switch (g_rdpdr_device[device].device_type)
{ {
case DEVICE_TYPE_SERIAL: case DEVICE_TYPE_SERIAL: