Skip to content

Commit d6ac6bf

Browse files
committed
Fix issues with CBW length
1 parent 23b9817 commit d6ac6bf

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

libogc/usbstorage.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ static s32 __send_cbw(usbstorage_handle *dev, u8 lun, u32 len, u8 flags, const u
240240
__stwbrx(cbw_buffer, 8, len);
241241
cbw_buffer[12] = flags;
242242
cbw_buffer[13] = lun;
243-
cbw_buffer[14] = (cbLen > 6 ? 10 : 6);
243+
cbw_buffer[14] = cbLen;
244244

245245
memcpy(cbw_buffer + 15, cb, cbLen);
246246

@@ -362,15 +362,15 @@ static s32 __usbstorage_clearerrors(usbstorage_handle *dev, u8 lun)
362362
memset(cmd, 0, sizeof(cmd));
363363
cmd[0] = SCSI_TEST_UNIT_READY;
364364

365-
retval = __cycle(dev, lun, NULL, 0, cmd, 1, 0, &status, NULL);
365+
retval = __cycle(dev, lun, NULL, 0, cmd, sizeof(cmd), 0, &status, NULL);
366366
if (retval < 0) return retval;
367367

368368
if (status)
369369
{
370370
cmd[0] = SCSI_REQUEST_SENSE;
371371
cmd[4] = SCSI_SENSE_REPLY_SIZE;
372372
memset(sense, 0, SCSI_SENSE_REPLY_SIZE);
373-
retval = __cycle(dev, lun, sense, SCSI_SENSE_REPLY_SIZE, cmd, 6, 0, NULL, NULL);
373+
retval = __cycle(dev, lun, sense, SCSI_SENSE_REPLY_SIZE, cmd, sizeof(cmd), 0, NULL, NULL);
374374
if (retval>=0) {
375375
switch (sense[2]&0xF) {
376376
case SCSI_SENSE_NOT_READY:
@@ -1066,7 +1066,7 @@ DISC_INTERFACE __io_usbstorage = {
10661066
__usbstorage_Flush,
10671067
__usbstorage_Shutdown,
10681068
0,
1069-
1,
1069+
0,
10701070
0
10711071
};
10721072

0 commit comments

Comments
 (0)