pki: When dispatching commands, don't look beyond non-null-terminated array
authorMartin Willi <martin@revosec.ch>
Wed, 19 Mar 2014 08:34:41 +0000 (09:34 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 19 Mar 2014 08:37:46 +0000 (09:37 +0100)
src/pki/command.c

index c2e0a5d..075a227 100644 (file)
@@ -263,7 +263,7 @@ int command_dispatch(int c, char *v[])
 
        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)
                {