nuttx/drivers/serial
Gregory Nutt 43183e5843 drivers/serial/pty.c: Correct returned number of bytes.
Reported by 권석근 <kwonsksj@gmail.com>:

I found a bug at "pty.c" during ssh server implementation.

When I turn on CONFIG_SERIAL_TERMIOS and OPOST|ONLCR on pty device
for nsh console's stdin/stdout (ssh shell service), I've got system crash.

Bugs at line 687 of pty.c, pty_write()
ntotal++;

when converting '\n' to '\r\n', pty_write() will return more than requested
(+1, for example) length. and this will break caller lib_fflush(), line 150
of lib_libfflush.c.
When she get (libfflush()) bytes_nwritten which is greater than nbuffer,
nbuffer goes to negative at line 150 and eventually destroys
*stream->fs_bufpos at line 163 of lib_libflush.c

Removing ntotal++;  line 687 of pty.c will fix this bug.

BTW, nsh using ptm/pty as a ssh shell service works great with libssh +
mbedtls.
2020-06-01 16:39:49 +01:00
..
Kconfig drivers/serial: Remove the nonexistent CMSDK_UART option 2020-02-24 08:47:36 -06:00
Kconfig-16550 Squashed commit of the following: 2018-08-26 11:37:16 -06:00
Kconfig-lpuart drivers/serial/Kconfig: Split serial Rx/Tx DMA. 2019-12-03 07:06:30 -06:00
Kconfig-sci We have ported NuttX on Renesas RX65N Micro-controller. This port includes following interfaces 2019-10-11 23:36:57 +08:00
Kconfig-uart drivers/serial/Kconfig: Split serial Rx/Tx DMA. 2019-12-03 07:06:30 -06:00
Kconfig-usart drivers/serial/Kconfig: Split serial Rx/Tx DMA. 2019-12-03 07:06:30 -06:00
Make.defs drivers/serial: Remove the lowconsole driver 2020-02-18 12:51:09 -06:00
ptmx.c Check return from nxsem_wait_initialize() 2020-04-01 14:20:04 -03:00
pty.c drivers/serial/pty.c: Correct returned number of bytes. 2020-06-01 16:39:49 +01:00
pty.h PTY: Add ioctls to support locking and unlocking of the slave. LIBC: Add implementation of unlockpt() 2016-07-15 09:39:33 -06:00
serial_dma.c Replace #include <semaphore.h> to #include <nuttx/semaphore.h> 2020-02-01 08:27:30 -06:00
serial_io.c Replace #include <semaphore.h> to #include <nuttx/semaphore.h> 2020-02-01 08:27:30 -06:00
serial.c sched/: Make more naming consistent 2020-05-17 14:01:00 -03:00
tcdrain.c z20x: Improve usability of bootloader 2020-03-14 14:07:45 -03:00
uart_16550.c Replace #include <semaphore.h> to #include <nuttx/semaphore.h> 2020-02-01 08:27:30 -06:00
uart_rpmsg.c Run codespell -w against all files 2020-02-22 14:45:07 -06:00