summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-04 21:31:40 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-04 21:31:40 +0000
commit22862b8f1a6f42be6640224ee3f704f532604723 (patch)
tree0381f57e501501dd7f983f90562f29c52bc969ba
parent1c9d5f4123e3cd9f85483cee391909e69601b949 (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
-rw-r--r--src/inspircd.cpp2
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);