1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Check if baudrate is valid, when parsing command-line arguments.

Before, every baudrate was initially accepted, and term_set() failed
when it attempted to set the baudrate.
This commit is contained in:
Nick Patavalis
2015-08-23 14:30:24 +03:00
parent 1c933e3797
commit 78d6c18bcc

View File

@ -1303,6 +1303,10 @@ parse_args(int argc, char *argv[])
break;
case 'b':
opts.baud = atoi(optarg);
if ( opts.baud == 0 || ! term_baud_ok(opts.baud) ) {
fprintf(stderr, "Invalid --baud: %d\n", opts.baud);
r = -1;
}
break;
case 'y':
switch (optarg[0]) {