Skip to content

Commit 178420b

Browse files
committed
fix(usb): limit CDC transmit blocks to packet size
1 parent e1884f2 commit 178420b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎libraries/USBDevice/src/cdc/cdc_queue.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ uint8_t *CDC_TransmitQueue_ReadBlock(CDC_TransmitQueue_TypeDef *queue,
8585
} else {
8686
*size = CDC_TRANSMIT_QUEUE_BUFFER_SIZE - queue->read;
8787
}
88+
89+
/* Limit the queued transaction to one endpoint packet. */
90+
if (*size > CDC_QUEUE_MAX_PACKET_SIZE) {
91+
*size = CDC_QUEUE_MAX_PACKET_SIZE;
92+
}
8893
queue->reserved = *size;
8994
return &queue->buffer[queue->read];
9095
}

0 commit comments

Comments
 (0)