head 1.1; access; symbols; locks; strict; comment @ * @; 1.1 date 2026.05.08.02.52.30; author khorben; state Exp; branches; next ; commitid 75DQ3EF3AJfJmXEG; desc @@ 1.1 log @comms/picocom: update to version 3.1 Changes in version 3.1: * Added the --raise-dtr and --raise-rts options, for symmetry with --lower-dtr and --lower-rts (see manual page for details) * Added custom baudrate support for FreeBSD, OpenBSD, and DragonflyBSD (in additions to Linux and MacOS that were already supported) * Better build support for custom baudrates. Now custom baudrate support is enabled by default for some systems (for Linux, kernels > 2.6.0, x86, and x86_64, for Intel Macs with macOS / OSX >= 10.4, and for some BDSs). You can always explicitly enable custom baudrate support for other systems (see Makefile) and you can explicitly disable it, even for the systems it is automatically enabled for (again, see Makefile). To see if custom baudrate support is enabled in your build, run picocom with the --help command-line option Changes in version 3.0: * Added the --logfile command line option. For more, see discussion in issue #24, as well as the manual. * Added the --lower-rts and --lower-dtr command-line options. These options lower (reset) the respective modem control lines of the serial port, as soon as picocom starts and the port is configured. For more details, see the manual as well as this discussion. * Added the --initstring (or -t) command line option. This option can be used to send an initialization string to the serial port when picocom starts. * Added the --exit-after (or -x) command line option. Causes picocom to exit if it becomes idle for the specified time. * Added the -exit (or -X) command line option. Causes picocom to exit immediately after opening and configuring the serial port. * Added the --quiet (or -q) command line option. Suppress output from picocom that was not explicitly requested by the user. Errors and command responses are still printed. * Added the --no-escape (or -n) command line option. Disables the escape character. If given picocom will never enter command mode. * Added the --hangup (or -u) comand line option. If given together with --noreset, picocom will not reset the serial port to it's original settings on exit, but it will clear the modem control lines (typically DTR and RTS) to signal a modem hangup. * Added the [C-g] command that toggles the state of the RTS modem control line. * Added the [C-w] command (write hex) that pompts the user for a string of hexadecimal values to be converted to binary and sent to the port. * Added "to hex" character mappings (???hex), which replace characters with their hexadecimal representation. For more see issue #75, and the INPUT, OUTPUT, AND ECHO MAPPING section in the picocom manual. * Standard input can now be a non-tty (e.g a file or a pipe). Useful in some occasions for doing trivial non-interactive stuff. * Changed the way picocom handles reading zero-bytes from the standard input. Now picocom waits for the output queue to be transmitted before exiting, or waits to become idle before exiting (if the --exit-after option is given). See the new section EXITING PICOCOM in the manual for details. * Picocom's serial port output queue is now dynamically growable. You can still set an upper limit when compiling picocom, or allow it to grow as much as your system's memory allows. Usueful, for example, for doing huge copy-pastes. See issue #33. * Custom baudrates are now also supported for OSX (not only Linux). See PR #62. * Fixed some minor backwards compatibility issues. Now you can use command-line options compatible with 1.x. For more details see issue #69, and PR #70. * Now SIGINT, as well as SIGTERM, can kill picocom. May be useful when the standard input is not a tty. @ text @$NetBSD$ Avoid a potential use after free condition: cc -O2 -Wall -g -DVERSION_STR=\"3.1\" -DTTY_Q_SZ=0 -DHIGH_BAUD -DUSE_FLOCK -DHISTFILE=\".picocom_history\" -DLINENOISE -o picocom.o -c picocom.c picocom.c: In function 'read_baud': picocom.c:608:9: warning: pointer 'baudstr' may be used after 'free' [-Wuse-after-free] 608 | add_history(baudstr); | ^~~~~~~~~~~~~~~~~~~~ picocom.c:604:9: note: call to 'free' here 604 | free(baudstr); | ^~~~~~~~~~~~~ --- picocom.c.orig 2026-04-26 13:38:46.249642608 +0000 +++ picocom.c @@@@ -601,12 +601,12 @@@@ read_baud (void) fd_printf(STO, "*** Invalid baudrate!"); baud = -1; } + + if (baud >= 0 && baudstr != NULL) + add_history(baudstr); free(baudstr); } while (baud < 0); - if (baudstr != NULL) - add_history(baudstr); - return baud; } @