linklayer / cantact-fw

Firmware source files for the CANtact tool
http://cantact.io
Other
260 stars 179 forks source link

useless copying and danger of buffer overflow #8

Open nichtgedacht opened 8 years ago

nichtgedacht commented 8 years ago

uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len) { uint8_t result = USBD_OK; /* USER CODE BEGIN 8 */ uint16_t i;

for (i=0; i < sizeof(UserTxBufferFS); i++) {
UserTxBufferFS[i] = 0;
}

for (i=0; i < Len; i++) {
UserTxBufferFS[i] = Buf[i];
}