From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6DA20475D for ; Thu, 28 Apr 2016 12:54:17 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 28 Apr 2016 03:54:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,546,1455004800"; d="scan'208";a="954698451" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga001.fm.intel.com with ESMTP; 28 Apr 2016 03:54:04 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.238]) by IRSMSX153.ger.corp.intel.com ([169.254.9.178]) with mapi id 14.03.0248.002; Thu, 28 Apr 2016 11:54:00 +0100 From: "Dumitrescu, Cristian" To: "Mrozowicz, SlawomirX" CC: "dev@dpdk.org" Thread-Topic: [PATCH] examples: fix CID 30708 out-of-bounds read Thread-Index: AQHRljMNQrftNsbZT0CFmSslydK8yZ+fS//A Date: Thu, 28 Apr 2016 10:54:00 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126479A6E46@IRSMSX108.ger.corp.intel.com> References: <1460627551-20552-1-git-send-email-slawomirx.mrozowicz@intel.com> In-Reply-To: <1460627551-20552-1-git-send-email-slawomirx.mrozowicz@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTUzNTNmODMtYmQyYy00ZTQ4LWE2MWUtZTdmMTFkZTA2ZWFiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkFFTWxTa3dUR3hCWk05YkFPTE9iRFJielFtUTErYlFoSUNJSUVLXC9oU0kwPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples: fix CID 30708 out-of-bounds read X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 10:54:17 -0000 > -----Original Message----- > From: Mrozowicz, SlawomirX > Sent: Thursday, April 14, 2016 10:53 AM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Mrozowicz, SlawomirX > > Subject: [PATCH] examples: fix CID 30708 out-of-bounds read >=20 > It fix coverity issue: > CID 30708 (#1 of 1): Out-of-bounds read (OVERRUN) > 12. overrun-local: Overrunning array tokens of 8 8-byte elements > at element index 4294967294 (byte offset 34359738352) > using index i (which evaluates to 4294967294). >=20 > Fixes: de3cfa2c9823 ("sched: initial import") > Signed-off-by: Slawomir Mrozowicz > --- > examples/qos_sched/args.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c > index 3e7fd08..d819269 100644 > --- a/examples/qos_sched/args.c > +++ b/examples/qos_sched/args.c > @@ -175,9 +175,11 @@ app_parse_opt_vals(const char *conf_str, char > separator, uint32_t n_vals, uint32 >=20 > n_tokens =3D rte_strsplit(string, strnlen(string, 32), tokens, n_vals, > separator); >=20 > - for(i =3D 0; i < n_tokens; i++) { > + if (n_tokens > MAX_OPT_VALUES) > + return -1; > + > + for (i =3D 0; i < n_tokens; i++) > opt_vals[i] =3D (uint32_t)atol(tokens[i]); > - } >=20 > free(string); >=20 > -- > 1.9.1 Acked-by: Cristian Dumitrescu