Included fixes:

* i < MAX_SUBOPTIONS_LENGTH -> i < MAX_SUBOPTIONS (i is a counter containing number of options, it has nothing to do with option-length)
* check if malloc returns NULL
* memset(xy, 0, sz-1) -> memset(xy, 0, sz)

--- src/plugins.c
+++ src/plugins.c
@@ -110,7 +110,11 @@
     memset(arg, 0, sizeof(arg));
 
     arg[0] = (char*)malloc(MAX_SUBOPTIONS_LENGTH);
-    memset(arg[0], 0, MAX_SUBOPTIONS_LENGTH-1);
+    if (NULL == arg[0]) {
+        app_err(THIS_FILE, "error allocating %u bytes", MAX_SUBOPTIONS_LENGTH);
+        goto end;
+    }
+    memset(arg[0], 0, MAX_SUBOPTIONS_LENGTH);
     i++;
     argc++;
 
@@ -121,11 +125,15 @@
         if(s == NULL) break;
 
         arg[i] = (char*)malloc(MAX_SUBOPTIONS_LENGTH);
-        memset(arg[i], 0, MAX_SUBOPTIONS_LENGTH-1);                
+        if (NULL == arg[i]) {
+            app_err(THIS_FILE, "error allocating %u bytes", MAX_SUBOPTIONS_LENGTH);
+            goto end;
+        }
+        memset(arg[i], 0, MAX_SUBOPTIONS_LENGTH);                
         memcpy(arg[i], s, MAX_SUBOPTIONS_LENGTH-1);        
         i++;            
     } 
-    while(i < MAX_SUBOPTIONS_LENGTH && argc > i);    
+    while(i < MAX_SUBOPTIONS && argc > i);    
     
     // ... just output log? (-log1 to -log5)
     if(argc>2) 
--- plugins/menu.plugin/menu.c
+++ plugins/menu.plugin/menu.c
@@ -401,7 +401,7 @@
         if(len > section_size) len = section_size - 1;
         param_start++;
 
-        memset(param_len, 0, sizeof(int) * MAX_ARGS - 1);
+        memset(param_len, 0, sizeof(int) * MAX_ARGS);
 
         // create section name
         if(section)
