Skip to content

Commit

Permalink
Merge pull request #991 from conan104/master
Browse files Browse the repository at this point in the history
Prevents indi_fli_wheel crash for FLI-CFW-1-8 model.
  • Loading branch information
knro authored Jul 27, 2019
2 parents 0038a85 + 8f43f5c commit bde5068
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 3rdparty/libfli/unix/libusb/libfli-usb-sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,14 +572,16 @@ long libusb_list(char *pattern, flidomain_t domain, char ***names)

if (FLIOpen(&dev, fli_device_name, domain) == 0) /* Opened and should have model */
{
strncpy(fli_model_name, DEVICE->devinfo.model, sizeof(fli_model_name) - 1);
if(DEVICE->devinfo.model == NULL)
DEVICE->devinfo.model = strdup("DEVICE->devinfo.model is NULL");
strncpy(fli_model_name, DEVICE->devinfo.model, sizeof(fli_model_name) - 1);
FLIClose(dev);
}
else
{
libusb_device_handle *usb_han;

if(libusb_open(usb_dev, &usb_han) == 0)
if( (libusb_open(usb_dev, &usb_han) == 0) && (usb_desc.iProduct > 0) )
{
libusb_get_string_descriptor_ascii(usb_han, usb_desc.iProduct,
(unsigned char *) fli_model_name, sizeof(fli_model_name) - 1);
Expand Down

0 comments on commit bde5068

Please sign in to comment.