Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

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

Open
Oxalin opened this issue Jan 30, 2018 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@Oxalin
Copy link
Owner

Oxalin commented Jan 30, 2018

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
Copy link
Owner Author

Oxalin commented Jan 30, 2018

What needs to be done:

  • investigate what's the root cause of this bug and if it has been fixed;
  • validate proposed fix.

@Oxalin Oxalin added this to the 1.0.0 milestone Mar 5, 2018
@Oxalin Oxalin added the bug Something isn't working label Mar 5, 2018
@MailYouLater
Copy link

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.

  • Indenting all of the code by four spaces and adding an empty line before the first line of code
  • Wrapping the code in three backticks: ```
    • "GitHub flavored markdown" also allows you to include syntax highlighting by placing the first set of backticks on it's own line along with the language the code should be treated as (e.g. ```diff) as described here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants