pki: Also check for MAX_COMMANDS when building getopt_long arguments
authorTobias Brunner <tobias@strongswan.org>
Fri, 20 Jun 2014 15:55:48 +0000 (17:55 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 24 Jun 2014 13:11:27 +0000 (15:11 +0200)
Completes 87e53819a6 and 0a8c399a21.

src/pki/command.c

index 075a227..13e8140 100644 (file)
@@ -73,7 +73,7 @@ static void build_opts()
        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;