From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 14C6C5699; Tue, 13 Jun 2017 12:07:32 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2017 03:07:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,337,1493708400"; d="scan'208";a="98843873" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga002.jf.intel.com with ESMTP; 13 Jun 2017 03:07:29 -0700 From: Bernard Iremonger To: dev@dpdk.org, adrien.mazarguil@6wind.com Cc: "Bernard.Iremonger" , stable@dpdk.org, Bernard Iremonger Date: Tue, 13 Jun 2017 11:07:27 +0100 Message-Id: <1497348447-1167-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-stable] [PATCH] librte_cmdline: fix parsing initialisation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jun 2017 10:07:33 -0000 From: "Bernard.Iremonger" The dyn_tokens array is initialised at the beginning of the cmdline_parse function. However when the inst_num variable is incremented later in the function the dyn_tokens array is not reinitialised so the tokens from the previous command are used. The solution is to initialise the dyn_tokens array in the while(inst) loop. Fixes: 4fffc05a2b2c ("cmdline: support dynamic tokens") CC: stable@dpdk.org Signed-off-by: Bernard Iremonger --- lib/librte_cmdline/cmdline_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index b814880..9ee28b8 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -276,7 +276,6 @@ return CMDLINE_PARSE_BAD_ARGS; ctx = cl->ctx; - memset(&dyn_tokens, 0, sizeof(dyn_tokens)); /* * - look if the buffer contains at least one line @@ -319,6 +318,7 @@ inst = ctx[inst_num]; while (inst) { debug_printf("INST %d\n", inst_num); + memset(&dyn_tokens, 0, sizeof(dyn_tokens)); /* fully parsed */ tok = match_inst(inst, buf, 0, tmp_result.buf, -- 1.9.1