strongswan.org
Wiki/Project Management
Downloads
Gitweb
projects
/
strongswan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7b35c02
)
swanctl: Fix enumeration of registered commands if MAX_COMMANDS is hit
author
Martin Willi
<martin@revosec.ch>
Wed, 9 Apr 2014 11:25:13 +0000
(13:25 +0200)
committer
Martin Willi
<martin@revosec.ch>
Wed, 7 May 2014 13:48:15 +0000
(15:48 +0200)
src/swanctl/command.c
patch
|
blob
|
history
diff --git
a/src/swanctl/command.c
b/src/swanctl/command.c
index
29f6be9
..
e488273
100644
(file)
--- a/
src/swanctl/command.c
+++ b/
src/swanctl/command.c
@@
-80,7
+80,7
@@
static void build_opts()
memset(command_optstring, 0, sizeof(command_optstring));
if (active == help_idx)
{
memset(command_optstring, 0, sizeof(command_optstring));
if (active == help_idx)
{
- for (i = 0; cmds[i].cmd; i++)
+ for (i = 0;
i < MAX_COMMANDS &&
cmds[i].cmd; i++)
{
command_opts[i].name = cmds[i].cmd;
command_opts[i].val = cmds[i].op;
{
command_opts[i].name = cmds[i].cmd;
command_opts[i].val = cmds[i].op;
@@
-218,7
+218,7
@@
int command_usage(char *error, ...)
fprintf(out, "usage:\n");
if (active == help_idx)
{
fprintf(out, "usage:\n");
if (active == help_idx)
{
- for (i = 0; cmds[i].cmd; i++)
+ for (i = 0;
i < MAX_COMMANDS &&
cmds[i].cmd; i++)
{
fprintf(out, " swanctl --%-10s (-%c) %s\n",
cmds[i].cmd, cmds[i].op, cmds[i].description);
{
fprintf(out, " swanctl --%-10s (-%c) %s\n",
cmds[i].cmd, cmds[i].op, cmds[i].description);
@@
-292,7
+292,7
@@
int command_dispatch(int c, char *v[])
build_opts();
op = getopt_long(c, v, command_optstring, command_opts, NULL);
build_opts();
op = getopt_long(c, v, command_optstring, command_opts, NULL);
- for (i = 0; cmds[i].cmd; i++)
+ for (i = 0;
i < MAX_COMMANDS &&
cmds[i].cmd; i++)
{
if (cmds[i].op == op)
{
{
if (cmds[i].op == op)
{