[dpdk-dev] librte_cmdline: fix parsing initialisation
Checks
Commit Message
From: "Bernard.Iremonger" <Bernard.iremonger@intel.com>
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 <bernard.iremonger@intel.com>
---
lib/librte_cmdline/cmdline_parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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,