diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-07-04 21:31:40 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-07-04 21:31:40 +0000 |
commit | 22862b8f1a6f42be6640224ee3f704f532604723 (patch) | |
tree | 0381f57e501501dd7f983f90562f29c52bc969ba /src | |
parent | 1c9d5f4123e3cd9f85483cee391909e69601b949 (diff) |
Fix possible segfault on giving an unknown cmdline argument. index holds the ref to the longopts array if found else it is NULL. optind however holds the next argv to be processed thus optind-1 is the correct index value to use.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11439 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ca89e0ef3..6ff5bfb30 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -464,7 +464,7 @@ InspIRCd::InspIRCd(int argc, char** argv) /* Unknown parameter */ default: /* Fall through to handle other weird values too */ - printf("Unknown parameter '%s'\n", argv[index]); + printf("Unknown parameter '%s'\n", argv[optind-1]); printf("Usage: %s [--nofork] [--nolog] [--debug] [--logfile <filename>]\n\ [--runasroot] [--version] [--config <config>] [--testsuite]\n", argv[0]); Exit(EXIT_STATUS_ARGV); |