Skip to content

Commit bf69c49

Browse files
committed
fix incorrect MTP xact_len calculation
1 parent 7a96291 commit bf69c49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/class/mtp/mtp_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static bool mtpd_data_xfer(mtp_container_info_t* p_container, uint8_t ep_addr) {
215215
TU_ASSERT(p_mtp->phase == MTP_PHASE_DATA);
216216
}
217217

218-
const uint16_t xact_len = tu_min16((uint16_t) (p_mtp->total_len - p_mtp->xferred_len), CFG_TUD_MTP_EP_BUFSIZE);
218+
const uint16_t xact_len = (uint16_t) tu_min32(p_mtp->total_len - p_mtp->xferred_len, CFG_TUD_MTP_EP_BUFSIZE);
219219
if (xact_len) {
220220
// already transferred all bytes in header's length. Application make an unnecessary extra call
221221
TU_VERIFY(usbd_edpt_claim(p_mtp->rhport, ep_addr));

0 commit comments

Comments
 (0)