From: akallabeth Date: Fri, 3 Jul 2020 11:33:08 +0000 (+0200) Subject: Reverted check for short usb descriptor X-Git-Tag: 2.2.0~1^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40a29037dfe663a81f63dd451868575622ca29a9;p=platform%2Fupstream%2Ffreerdp.git Reverted check for short usb descriptor (cherry picked from commit 6ba67a07beeb44878912851cf6ed6c6bf7443e09) --- diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c index ce231ba..7072d9d 100644 --- a/channels/urbdrc/client/libusb/libusb_udevice.c +++ b/channels/urbdrc/client/libusb/libusb_udevice.c @@ -762,7 +762,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT { UDEVICE* pdev = (UDEVICE*)idev; LIBUSB_DEVICE_DESCRIPTOR* devDescriptor; - const char* strDesc = "Generic Usb String"; + const char strDesc[] = "Generic Usb String"; char deviceLocation[25] = { 0 }; BYTE bus_number; BYTE device_address; @@ -795,7 +795,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT slen = data[0]; locale = data[1]; - if ((ret <= 0) || (ret < 4) || (slen < 4) || (locale != LIBUSB_DT_STRING) || + if ((ret <= 0) || (ret <= 4) || (slen <= 4) || (locale != LIBUSB_DT_STRING) || (ret > UINT8_MAX)) { WLog_Print(urbdrc->log, WLOG_DEBUG, @@ -803,7 +803,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT "ERROR num %d, iProduct: %" PRIu8 "!", ret, devDescriptor->iProduct); - len = MIN(sizeof(strDesc), inSize); + len = strnlen(strDesc, MIN(sizeof(strDesc), inSize)); for (i = 0; i < len; i++) text[i] = (WCHAR)strDesc[i];