From: "Graves, Daniel (GE Healthcare)" <Daniel.Graves@ge.com>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] Serial Driver imrpovement
Date: Fri, 22 Jun 2012 16:10:00 -0000 [thread overview]
Message-ID: <6F6D3EC964AAC24D9C45644424DE2D810C2F6486@CINMLVEM19.e2k.ad.ge.com> (raw)
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;
----------------------
The line gap == cbuf->len will not always evaluate to true if garbage data is received. This will cause the put variable to shoot way past len.
Thanks,
Daniel P Graves
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
next reply other threads:[~2012-06-22 16:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-22 16:10 Graves, Daniel (GE Healthcare) [this message]
2012-07-01 2:37 ` Jonathan Larmour
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6F6D3EC964AAC24D9C45644424DE2D810C2F6486@CINMLVEM19.e2k.ad.ge.com \
--to=daniel.graves@ge.com \
--cc=ecos-discuss@ecos.sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).