[dpdk-dev] cmdline: avoid garbage in unused fields of parsed result
Checks
Commit Message
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(+)
Comments
On Sat, Jan 20, 2018 at 11:26:31AM +0800, Xueming Li wrote:
> 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>
22/01/2018 14:14, Olivier Matz:
> On Sat, Jan 20, 2018 at 11:26:31AM +0800, Xueming Li wrote:
> > 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>
Applied, thanks
@@ -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);