pki: Print a warning if MAX_COMMANDS is too low
authorTobias Brunner <tobias@strongswan.org>
Wed, 11 Dec 2013 16:23:43 +0000 (17:23 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 23 Jan 2014 09:10:53 +0000 (10:10 +0100)
src/pki/command.c

index 593ff37..415e78b 100644 (file)
@@ -140,6 +140,13 @@ void command_register(command_t command)
 {
        int i;
 
+       if (registered == MAX_COMMANDS)
+       {
+               fprintf(stderr, "unable to register command, please increase "
+                               "MAX_COMMANDS\n");
+               return;
+       }
+
        cmds[registered] = command;
        /* append default options, but not to --help */
        if (!active)