Oxalin / usbip_windows

Project halted, moving to joint venture, see Readme. Revive Windows' USB/IP drivers and tools from the dormant SourceForge's one
92 stars 36 forks source link

From SourceForge: invalid URB length (less than 4 bytes), some devices don't respond #1

Open Oxalin opened 6 years ago

Oxalin commented 6 years ago

Reported by: daniel danzberger Date: 2013-02-18 Link: https://sourceforge.net/p/usbip/discussion/418507/thread/af21439c/

Description: "invalid read lengths < 4 bytes on some urbs. Causes some devices to not respond on this urb."

Proposed fix (to be validated): Index: busenum.c -- busenum.c (revision 201) +++ busenum.c (working copy) @@ -832,15 +832,23 @@

CHECK_SIZE_READ

++ len = req->TransferBufferLength; ++ ++ / minimal read len is 4 bytes / ++ if (len != 0 && len < 4) ++ len = 4; ++ set_cmd_submit_usbip_header (h, seqnum, devid, USBIP_DIR_IN, 0, -- USBD_SHORT_TRANSFER_OK, req->TransferBufferLength); ++ USBD_SHORT_TRANSFER_OK, ++ len ++ ); build_setup_packet(setup, USBIP_DIR_IN, BMREQUEST_STANDARD, BMREQUEST_TO_DEVICE, USB_REQUEST_GET_DESCRIPTOR);

-- setup->wLength = (unsigned short)req->TransferBufferLength; ++ setup->wLength = (unsigned short)len; setup->wValue = (req->DescriptorType<<8) | req->Index;

switch(req->DescriptorType){ Index: busenum.h

Oxalin commented 6 years ago

What needs to be done:

MailYouLater commented 6 years ago

Shouldn't that diff be in a code block?

In case you're not familiar with Markdown:

Multi-line code blocks can be formed in two ways.