mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
Fixed possible out of bound access in usb channel.
This commit is contained in:
parent
66dc4cc9ee
commit
2e5280feec
@ -1744,12 +1744,11 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
|
|||||||
|
|
||||||
WLog_Print(urbdrc->log, WLOG_INFO, "VID: 0x%04" PRIX16 ", PID: 0x%04" PRIX16 "", idVendor,
|
WLog_Print(urbdrc->log, WLOG_INFO, "VID: 0x%04" PRIX16 ", PID: 0x%04" PRIX16 "", idVendor,
|
||||||
idProduct);
|
idProduct);
|
||||||
array = (UDEVICE**)calloc(16, sizeof(UDEVICE*));
|
total_device = libusb_get_device_list(ctx, &libusb_list);
|
||||||
|
array = (UDEVICE**)calloc(total_device, sizeof(UDEVICE*));
|
||||||
|
|
||||||
if (!array)
|
if (!array)
|
||||||
return 0;
|
goto fail;
|
||||||
|
|
||||||
total_device = libusb_get_device_list(ctx, &libusb_list);
|
|
||||||
|
|
||||||
for (i = 0; i < total_device; i++)
|
for (i = 0; i < total_device; i++)
|
||||||
{
|
{
|
||||||
@ -1768,6 +1767,7 @@ size_t udev_new_by_id(URBDRC_PLUGIN* urbdrc, libusb_context* ctx, UINT16 idVendo
|
|||||||
free(descriptor);
|
free(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
libusb_free_device_list(libusb_list, 1);
|
libusb_free_device_list(libusb_list, 1);
|
||||||
*devArray = (IUDEVICE**)array;
|
*devArray = (IUDEVICE**)array;
|
||||||
return num;
|
return num;
|
||||||
|
Loading…
Reference in New Issue
Block a user