Skip to content

Commit

Permalink
ioctl: Allow ZLP control writes
Browse files Browse the repository at this point in the history
Closes #21

Signed-off-by: Tormod Volden <[email protected]>
[Peter: only consider zlp if transfer_buffer_length is zero]
Signed-off-by: Peter Dons Tychsen <[email protected]>
  • Loading branch information
tormodvolden committed Oct 17, 2021
1 parent ee27cd5 commit 52521d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libusb/src/driver/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ NULL : input_buffer + sizeof(libusb_request),
dispCtlCode = "CONTROL_WRITE";

// check if the request and buffer is valid
if (!request || !transfer_buffer_mdl || input_buffer_length < sizeof(libusb_request))
// allow for zero length control packets
if (!request || (!transfer_buffer_mdl && transfer_buffer_length) || input_buffer_length < sizeof(libusb_request))
{
USBERR("%s: invalid transfer request\n", dispCtlCode);
status = STATUS_INVALID_PARAMETER;
Expand Down

0 comments on commit 52521d0

Please sign in to comment.