mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
termios: Fix infinite loop in receive path
In canonical mode, the raw input buffer or the canonical buffer may overflow without an end of line. Avoid an infinite loop in this case. Update #2915.
This commit is contained in:
@@ -1521,13 +1521,17 @@ fillBufferQueue (struct rtems_termios_tty *tty)
|
||||
/*
|
||||
* Wait for characters
|
||||
*/
|
||||
if ( wait ) {
|
||||
rtems_status_code sc;
|
||||
if (wait) {
|
||||
if (tty->ccount < CBUFSIZE - 1) {
|
||||
rtems_status_code sc;
|
||||
|
||||
sc = rtems_semaphore_obtain(
|
||||
tty->rawInBuf.Semaphore, tty->rawInBufSemaphoreOptions, timeout);
|
||||
if (sc != RTEMS_SUCCESSFUL)
|
||||
sc = rtems_semaphore_obtain(
|
||||
tty->rawInBuf.Semaphore, tty->rawInBufSemaphoreOptions, timeout);
|
||||
if (sc != RTEMS_SUCCESSFUL)
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user