From: dv1tas Date: Fri, 25 Nov 2011 12:05:17 +0000 (+0000) Subject: should check argc X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=302b8b96ee8f2241d0b96cfc7fad9008cdea8bbb;p=people%2Fms%2Fmstpd.git should check argc git-svn-id: svn://svn.code.sf.net/p/mstpd/code/trunk@20 fbe50366-0c72-4402-a84b-5d246361dba7 --- diff --git a/ctl_main.c b/ctl_main.c index c294b9c..4faa49e 100644 --- a/ctl_main.c +++ b/ctl_main.c @@ -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); }