Skip to content

Commit

Permalink
Detect edge case when argc == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
keithw committed Oct 20, 2012
1 parent 06661c9 commit da18a8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/frontend/mosh-client.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "stmclient.h" #include "stmclient.h"
#include "crypto.h" #include "crypto.h"
#include "locale_utils.h" #include "locale_utils.h"
#include "fatal_assert.h"


/* these need to be included last because of conflicting defines */ /* these need to be included last because of conflicting defines */
#include <curses.h> #include <curses.h>
Expand Down Expand Up @@ -72,6 +73,9 @@ int main( int argc, char *argv[] )
/* For security, make sure we don't dump core */ /* For security, make sure we don't dump core */
Crypto::disable_dumping_core(); Crypto::disable_dumping_core();


/* Detect edge case */
fatal_assert( argc > 0 );

/* Get arguments */ /* Get arguments */
int opt; int opt;
while ( (opt = getopt( argc, argv, "c" )) != -1 ) { while ( (opt = getopt( argc, argv, "c" )) != -1 ) {
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/mosh-server.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include "pty_compat.h" #include "pty_compat.h"
#include "select.h" #include "select.h"
#include "timestamp.h" #include "timestamp.h"
#include "fatal_assert.h"


#ifndef _PATH_BSHELL #ifndef _PATH_BSHELL
#define _PATH_BSHELL "/bin/sh" #define _PATH_BSHELL "/bin/sh"
Expand Down Expand Up @@ -159,6 +160,9 @@ int main( int argc, char *argv[] )
/* For security, make sure we don't dump core */ /* For security, make sure we don't dump core */
Crypto::disable_dumping_core(); Crypto::disable_dumping_core();


/* Detect edge case */
fatal_assert( argc > 0 );

char *desired_ip = NULL; char *desired_ip = NULL;
char *desired_port = NULL; char *desired_port = NULL;
string command_path; string command_path;
Expand Down

0 comments on commit da18a8c

Please sign in to comment.