Detect edge case when argc == 0
This commit is contained in:
@@ -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>
|
||||||
@@ -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 ) {
|
||||||
|
|||||||
@@ -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"
|
||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user