DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@mellanox.com>
To: Olivier MATZ <olivier.matz@6wind.com>
Cc: Xueming Li <xuemingl@mellanox.com>,
	dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] cmdline: avoid garbage in unused fields of parsed result
Date: Sat, 20 Jan 2018 11:26:31 +0800	[thread overview]
Message-ID: <20180120032631.132978-1-xuemingl@mellanox.com> (raw)

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>
---
 lib/librte_cmdline/cmdline_parse.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index c74b146fc..7f799f94d 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);
-- 
2.13.3

             reply	other threads:[~2018-01-20  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20  3:26 Xueming Li [this message]
2018-01-22 13:14 ` Olivier Matz
2018-01-25 22:17   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180120032631.132978-1-xuemingl@mellanox.com \
    --to=xuemingl@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).