summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/getopt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/getopt.c b/src/core/getopt.c
index 4e839cab2..547aa6940 100644
--- a/src/core/getopt.c
+++ b/src/core/getopt.c
@@ -227,6 +227,10 @@ int getopt_long ( int argc, char * const argv[], const char *optstring,
enum getopt_argument_requirement has_arg;
int option;
+ /* Check for end of argv array */
+ if ( optind >= argc )
+ return -1;
+
/* Check for end of options */
if ( *(opttext++) != '-' )
return -1;