fixed unsafe use of CDC_Send(... buf, uint8_t count): count was only an uint8_t, passing arbitrary non 8-bit integers failed. use uint32_t instead - fixes 1899

This commit is contained in:
fishpepper 2016-12-27 21:07:24 +01:00
parent 1771a97d86
commit 0dbf72f9fb
3 changed files with 3 additions and 3 deletions

View File

@ -111,7 +111,7 @@ static void usbVcpWriteBuf(serialPort_t *instance, const void *data, int count)
static bool usbVcpFlush(vcpPort_t *port)
{
uint8_t count = port->txAt;
uint32_t count = port->txAt;
port->txAt = 0;
if (count == 0) {

View File

@ -282,7 +282,7 @@ static void IntToUnicode(uint32_t value, uint8_t *pbuf, uint8_t len)
* Output : None.
* Return : None.
*******************************************************************************/
uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint8_t sendLength)
uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint32_t sendLength)
{
/* Last transmission hasn't finished, abort */
if (packetSent) {

View File

@ -55,7 +55,7 @@ void Leave_LowPowerMode(void);
void USB_Interrupts_Config(void);
void USB_Cable_Config(FunctionalState NewState);
void Get_SerialNum(void);
uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint8_t sendLength); // HJI
uint32_t CDC_Send_DATA(const uint8_t *ptrBuffer, uint32_t sendLength); // HJI
uint32_t CDC_Send_FreeBytes(void);
uint32_t CDC_Receive_DATA(uint8_t* recvBuf, uint32_t len); // HJI
uint32_t CDC_Receive_BytesAvailable(void);