From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernard Iremonger Subject: [PATCH] librte_cmdline: fix parsing initialisation Date: Tue, 13 Jun 2017 11:07:27 +0100 Message-ID: <1497348447-1167-1-git-send-email-bernard.iremonger@intel.com> Cc: "Bernard.Iremonger" , stable@dpdk.org, Bernard Iremonger To: dev@dpdk.org, adrien.mazarguil@6wind.com Return-path: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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