summaryrefslogtreecommitdiff
path: root/lib/librte_cmdline
diff options
context:
space:
mode:
authorXueming Li <xuemingl@mellanox.com>2018-01-20 11:26:31 +0800
committerThomas Monjalon <thomas@monjalon.net>2018-01-25 23:16:53 +0100
commit0bf876008f4e51d8c006a3adb3866f0c35c33fbb (patch)
tree2c0e468dbafede0ac60eac0f5e2ac4ac10ef1c74 /lib/librte_cmdline
parent2acf7432ad3e67f676d7d14a6acc3b90a2d9117e (diff)
downloaddpdk-next-eventdev-0bf876008f4e51d8c006a3adb3866f0c35c33fbb.zip
dpdk-next-eventdev-0bf876008f4e51d8c006a3adb3866f0c35c33fbb.tar.gz
dpdk-next-eventdev-0bf876008f4e51d8c006a3adb3866f0c35c33fbb.tar.xz
cmdline: avoid garbage in unused fields of parsed result
The result buffer was not initialized before parsing, inducing garbage in unused fields or padding of the parsed structure. Initialize the result buffer each time before parsing. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Xueming Li <xuemingl@mellanox.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Diffstat (limited to 'lib/librte_cmdline')
-rw-r--r--lib/librte_cmdline/cmdline_parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index c74b146..7f799f9 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -168,6 +168,8 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,
int n = 0;
struct cmdline_token_hdr token_hdr;
+ if (resbuf != NULL)
+ memset(resbuf, 0, resbuf_size);
/* check if we match all tokens of inst */
while (!nb_match_token || i < nb_match_token) {
token_p = get_token(inst, i);