File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -715,19 +715,30 @@ int main(int argc, char *argv[])
715715
716716 emu_core_preinit ();
717717
718+ if (argc <= 1 ){
719+ printf ("Not enough args specified, exit\n" );
720+ exit (EXIT_FAILURE );
721+ };
722+
718723 // read command line options
719724 for (i = 1 ; i < argc ; i ++ ) {
720725 if (!strcmp (argv [i ], "-psxout" )) psxout = 1 ;
721726 else if (!strcmp (argv [i ], "-load" )) loadst = atol (argv [++ i ]);
722727 else if (!strcmp (argv [i ], "-cfg" )) {
723- if (i + 1 >= argc ) break ;
728+ if (i + 1 >= argc ){
729+ printf ("Config file not specified, exit\n" );
730+ exit (EXIT_FAILURE );
731+ };
724732 strncpy (cfgfile_basename , argv [++ i ], MAXPATHLEN - 100 ); /* TODO buffer overruns */
725733 SysPrintf ("Using config file %s.\n" , cfgfile_basename );
726734 }
727735 else if (!strcmp (argv [i ], "-cdfile" )) {
728736 char isofilename [MAXPATHLEN ];
729737
730- if (i + 1 >= argc ) break ;
738+ if (i + 1 >= argc ){
739+ printf ("cdfile arg present but cd file not specified, exit\n" );
740+ exit (EXIT_FAILURE );
741+ };
731742 strncpy (isofilename , argv [++ i ], MAXPATHLEN );
732743 if (isofilename [0 ] != '/' ) {
733744 getcwd (path , MAXPATHLEN );
You can’t perform that action at this time.
0 commit comments