22 Jun 2012 18:10
Serial Driver imrpovement
Graves, Daniel (GE Healthcare <Daniel.Graves <at> ge.com>
2012-06-22 16:10:09 GMT
2012-06-22 16:10:09 GMT
Hello,
Note that this might have been fixed already but just in case:
I found that the following code in Serial.c will cause a buffer overflow if there is garbage data on the wire
before a thread has started reading from the serial port:
------------------------------------------------
static rcv_req_reply_t
serial_data_rcv_req(serial_channel *chan, int avail,
int* space_avail, unsigned char** space)
{
cbuf_t *cbuf = &chan->in_cbuf;
int gap;
#ifdef CYGOPT_IO_SERIAL_FLOW_CONTROL_SOFTWARE
// When there is software flow-control, force the serial device
// driver to use the single-char xmt/rcv functions, since these
// have to make policy decision based on the data. Rcv function
// may also have to transmit data to throttle the xmitter.
If (chan->config.flags & (CYGNUM_SERIAL_FLOW_XONXOFF_TX|CYGNUM_SERIAL_FLOW_XONXOFF_RX))
return CYG_RCV_DISABLED;
#endif
CYG_ASSERT(false == cbuf->block_mode_xfer_running,
"Attempting new block transfer while another is running");
// Check for space
gap = cbuf->nb;
if (gap == cbuf->len)
return CYG_RCV_FULL;
(Continue reading)
RSS Feed