aboutsummaryrefslogtreecommitdiffstats
path: root/src/pki
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2015-12-16 11:53:01 +0100
committerTobias Brunner <tobias@strongswan.org>2015-12-16 12:07:13 +0100
commit8ea64a78d65807c8496e9d089f18af001aeb932d (patch)
tree7ea853187defde4785c7845f58635bebd1324deb /src/pki
parentbf5754adcd720dbce09830176ba274f93196b8b7 (diff)
downloadstrongswan-8ea64a78d65807c8496e9d089f18af001aeb932d.tar.bz2
strongswan-8ea64a78d65807c8496e9d089f18af001aeb932d.tar.xz
pki: Never print more than MAX_LINES of usage summary
Print a warning if a registered command exceeds that limit.
Diffstat (limited to 'src/pki')
-rw-r--r--src/pki/command.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pki/command.c b/src/pki/command.c
index 13e81404c..ce704dbb8 100644
--- a/src/pki/command.c
+++ b/src/pki/command.c
@@ -172,6 +172,15 @@ void command_register(command_t command)
"options", '+', 1, "read command line options from file"
};
}
+ for (i = 0; cmds[registered].line[i]; i++)
+ {
+ if (i == MAX_LINES - 1)
+ {
+ fprintf(stderr, "command '%s' specifies too many usage summary "
+ "lines, please increase MAX_LINES\n", command.cmd);
+ break;
+ }
+ }
}
registered++;
}
@@ -208,7 +217,7 @@ int command_usage(char *error)
}
else
{
- for (i = 0; cmds[active].line[i]; i++)
+ for (i = 0; i < MAX_LINES && cmds[active].line[i]; i++)
{
if (i == 0)
{