mosh-server: Catch exception for parsing nonintegral number of colors

Print a real error message instead of abnormally aborting.  Found by
Coverity Scan service.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2014-04-23 15:43:56 -04:00
committed by John Hood
parent 23f0eedb8c
commit c03bacd0c9
+7 -1
View File
@@ -200,7 +200,13 @@ int main( int argc, char *argv[] )
fatal_assert( desired_ip );
break;
case 'c':
colors = myatoi( optarg );
try {
colors = myatoi( optarg );
} catch ( const CryptoException & ) {
fprintf( stderr, "%s: Bad number of colors (%s)\n", argv[ 0 ], optarg );
print_usage( argv[ 0 ] );
exit( 1 );
}
break;
case 'v':
verbose = true;