]> git.ipfire.org Git - people/ms/mstpd.git/commitdiff
should check argc
authordv1tas <dv1tas@fbe50366-0c72-4402-a84b-5d246361dba7>
Fri, 25 Nov 2011 12:05:17 +0000 (12:05 +0000)
committerdv1tas <dv1tas@fbe50366-0c72-4402-a84b-5d246361dba7>
Fri, 25 Nov 2011 12:05:17 +0000 (12:05 +0000)
git-svn-id: svn://svn.code.sf.net/p/mstpd/code/trunk@20 fbe50366-0c72-4402-a84b-5d246361dba7

ctl_main.c

index c294b9cf963a473d843d04f8872b54205d43a849..4faa49e1f51fd1e7c0f9da2e191c3ec284f2fadf 100644 (file)
@@ -910,8 +910,17 @@ static int cmd_setfid2mstid(int argc, char *const *argv)
 
 static int cmd_stp_mode_notification(int argc, char *const *argv, bool on)
 {
-    int br_index = get_index(argv[1], "bridge");
-    if(0 > br_index)
+    int br_index;
+    /* Because this command has special handling,
+     * argc was not checked earlier
+     */
+    if(2 > argc)
+    {
+        fprintf(stderr,
+                "Incorrect number of arguments for notification command\n");
+        exit(1);
+    }
+    if(0 > (br_index = get_index(argv[1], "bridge")))
         return br_index;
     return CTL_stp_mode_notification(br_index, on);
 }